如何从自动关闭停止C#控制台应用程序?

编程入门 行业动态 更新时间:2024-10-27 08:37:12
本文介绍了如何从自动关闭停止C#控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

解决方案

到Console.ReadLine();

Console.ReadKey();

ReadLine()等待↩,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#控制台应用程序?

本文发布于:2023-11-12 09:49:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   应用程序   自动关闭

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!