How to stop C# console applications from closing automatically?
This question already has an answer here:
Console.ReadLine();
or
Console.ReadKey();
ReadLine()
waits for ↩, ReadKey()
waits for any key (except for modifier keys).
Edit: stole the key symbol from Darin.
You can just compile (start debugging) your work with Ctrl+F5.
Try it. I always do it and the console shows me my results open on it. No additional code is needed.
尝试使用Visual Studio中的Ctrl + F5来运行程序,这会在没有任何Console.Readline()或ReadKey()函数的情况下自动添加“按任意键继续...”的暂停。
链接地址: http://www.djcxy.com/p/50574.html下一篇: 如何阻止C#控制台应用程序自动关闭?