Monodevelop on Ubuntu Console.ReadLine doesn't

2020-04-09 03:04发布

问题:

I'm trying to develop on Mono platform on Ubuntu. But I got trouble on my first application :) Here is the code:

using System;
using System.Threading;

namespace threadings
{
class MainClass
{
    public static void Main (string[] args)
    {
        Console.WriteLine ("The start");
        string x=Console.ReadLine();
        Console.WriteLine(x);
        Console.WriteLine ("the end");
    }


}

}

And here is the result:

The start

the end

And no any string between them, and no reading from console happens, and I can't input anything. What is the problem? Maybe I do something wrong?

My environment:

Ubuntu: Linux nozim-desktop 2.6.32-32-generic-pae
MonoDevelop: 
        version: 2.2.1 
        Build date: 2010-03-09 16:12:25+0000

回答1:

MonoDevelop's default console doesn't support ReadLine(), but you can set an option in the project options to launch an external console instead.

Options / Run / General / Run on external console