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 入住酒店文案祝福语简短