C#应用程序中的退出方法
Environment.Exit()方法
Environment.Exit()方法终止进程并将退出代码返回到操作系统-
Environment.Exit(exitCode);
将exitCode设置为0(零)以表明该过程成功完成。
使用exitCode作为非零数字来显示错误,例如-
Environment.Exit(1)-返回值1以显示所需文件不存在
Environment.Exit(2)-返回值2表示文件格式错误。
System.Windows.Forms.Application.ExitThread()
要关闭Windows窗体中的子应用程序或当前线程,请使用System.Windows.Forms.Application.ExitThread()。
private void buttonClose_Click(object sender, EventArgs eventArgs) {
System.Windows.Forms.Application.ExitThread( );
}热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语