Console.ReadLine is skipped

The C # command is Console.ReadLine()simply ignored when I run my code with mono filename.exeafter compiling it with gmcs filename.cs. What can happen? Even when I try to run the simple code below, it skips to the end, as if it weren't running anything.

static void Main(string[] args) {
    string value = Console.ReadLine();
    Console.WriteLine("You entered: {0}", value);
    Console.WriteLine("Press ENTER to continue...");
    Console.ReadLine();   // Returns immediately.
    Console.WriteLine("Continuing....");
}
+5
source share
2 answers

I guess this is your problem.

C # why does it skip my .readline () console?

I have seen this before in my own materials and could not remember the solution. Basically, you have a user who clicks on a carriage return, which sends a carriage return and a line feed, causing the line reading to start. Can you use Read..Key (someCharacter);

0

, . , , Console.ReadLine();, ? , , , " " , . , .

0

All Articles