简体   繁体   English

为了在 Windows 应用程序中以 C# 结尾,End (VB6/VBA) 的等价物是什么?

[英]What is the equivalent of End (VB6/VBA) in order to end in C# for Windows applications?

为了结束使用 C# 的应用程序, End (VB6/VBA) 的等价物是什么?

The marked answer is not correct.标记的答案不正确。 Application.Exit() is a graceful shutdown, it can be blocked by a form's FormClosing event handler setting e.Cancel = true. Application.Exit() 是一个优雅的关闭,它可以被表单的 FormClosing 事件处理程序设置 e.Cancel = true 阻止。 The exact equivalent to the VB End statement is Environment.Exit(0);与 VB End 语句完全等效的是 Environment.Exit(0);

To terminate Windows Forms application use:要终止 Windows 窗体应用程序,请使用:

Application.Exit();

To terminate a console application you must return the main function.要终止控制台应用程序,您必须返回主函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM