Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop C# console applications from closing automatically? [duplicate]

My console applications on Visual Studio are closing automatically, therefore, I'd like to use something like C's system("PAUSE") to "pause" the applications at the end of their execution. How can I achieve that?

like image 360
Zignd Avatar asked Jul 16 '12 21:07

Zignd


1 Answers

Console.ReadLine(); 

or

Console.ReadKey(); 

ReadLine() waits for , ReadKey() waits for any key (except for modifier keys).

Edit: stole the key symbol from Darin.

like image 106
Adam Avatar answered Oct 09 '22 10:10

Adam