Because my Visual Studio console programs close automatically, I’d like to utilize something like C’s system(“PAUSE”) to “pause” them at the end of their operation. What can I do to make it happen?
Asked by Zignd
ReadKey() waits for any key, while ReadLine() waits for any line (except for modifier keys).
Darin gave me the key symbol, which I stole.
Answered by Adam
Ctrl+F5 will compile (start debugging) your work for you.
Give it a shot. It’s something I constantly do, and the console always gives me my findings open on it. There is no need for any additional code.
Answered by Silvia Z
Try running your application with Ctrl + F5 in Visual Studio; this will automatically add a pause with “Press any key to continue…” without using the Console. Use the Readline() or ReadKey() functions to read a line or a key.
Answered by Sohail xIN3N
Console. Wait for the user to press Enter or Console before calling ReadLine(). Wait for any key with ReadKey.
Answered by Darin Dimitrov
If you want it to close when you touch any key, or if you want it to open when you press any key, or if you want it to
When the user presses enter after typing anything.
Answered by matthewr
Post is based on https://stackoverflow.com/questions/11512821/how-to-stop-c-sharp-console-applications-from-closing-automatically