0
My code doesn't execute on VS 2012
The very same code doesn't execute unless I end my code with Console.Read(); why it that?
5 Answers
+ 1
Yes, the Console application on c# at the end you need to put Console.ReadLine() as like we put getch() in C programming ^_^ . but it for our UI purpose , if you don't write it, till the application run but we can't able to see the output console , that's why we put the readKey()
0
the code is execute , but the process is fast so , you can't able to see that on terminal.
As you write console.read() it wait till you press Enter or Console.readKey() it wait till any key press and then after the terminal goes.
0
Thanks Ap Star, so every code must end with Console.ReadLine(); if it has to be executed by pressing Enter?
0
The end code should be
Console.ReadLine ();
OR
Console.ReadKey ();