如何从自动关闭停止C#控制台应用程序? [英] How to stop C# console applications from closing automatically?

查看:2107
本文介绍了如何从自动关闭停止C#控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中我的控制台应用程序会自动关闭,所以我想用类似于C的系统(暂停)来暂停该应用程序其执行结束,我怎么能做到这一点?


解决方案

 到Console.ReadLine();

  Console.ReadKey();

<一个href=\"http://www.google.at/url?sa=t&rct=j&q=msdn%20console.readline&source=web&cd=1&ved=0CF0QFjAA&url=http://msdn.microsoft.com/en-us/library/system.console.readline.aspx&ei=TYcEULiaJrP44QTu67yvCA&usg=AFQjCNFMXhCW9ehvUKRE3oSY4hDHnpeX8Q\"><$c$c>ReadLine()等待<大骨节病>↩,<一个href=\"http://www.google.at/url?sa=t&rct=j&q=msdn%20console.readkey&source=web&cd=1&ved=0CFkQFjAA&url=http://msdn.microsoft.com/en-us/library/system.console.readkey.aspx&ei=f4cEUPfwCcOn4gTJrt2TCA&usg=AFQjCNEzY4-zX-qXR8RLKZW-9_xbT2uxxQ\"><$c$c>ReadKey()等待任意键(除修改键)。

编辑:从达林偷了钥匙符号

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

解决方案

Console.ReadLine();

or

Console.ReadKey();

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

Edit: stole the key symbol from Darin.

这篇关于如何从自动关闭停止C#控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆