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 红包祝福语简短10字
18 周六早晨祝福语简短