C# 控制台应用程序 - 显式终止(不是 Env..Exit)
我听说在 .NET CF Environment.Exit 上不起作用。有没有通用的方法来终止(以标准方式)控制台应用程序?谢谢
I have heard that on .NET CF Environment.Exit does not work. Is there any universal way how to terminate (in a standard way) the console app? Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当没有非后台线程运行时,应用程序会自动终止。
当没有更多代码可以执行时,线程会自动停止运行。
因此,当您希望应用程序终止时,只需让应用程序不再执行任何代码即可。
An application automatically terminates when there is no non-background thread running.
A thread automatically stops running when there is no more code to execute.
So, just make your application have no more code to execute when you want it to terminate.