Exit method in C# application

PHPz
Release: 2023-08-30 21:45:02
forward
968 people have browsed it

C# 应用程序中的退出方法

Environment.Exit() method

Environment.Exit() method terminates the process and returns an exit code to the operating system -

Environment.Exit(exitCode);
Copy after login

Use exitCode as 0 (zero) to show that the process completed successfully.

Use exitCode as a non-zero number to display errors, for example -

  • Environment.Exit(1)- a return value of 1 means you want The file does not exist

  • Environment.Exit(2)- A return value of 2 indicates that the file format is incorrect.

System.Windows.Forms .Application.ExitThread( )

To close a child application or the current thread in Windows Forms, use System.Windows.Forms .Application.ExitThread( ).

private void buttonClose_Click(object sender, EventArgs eventArgs) { System.Windows.Forms.Application.ExitThread( ); }
Copy after login

The above is the detailed content of Exit method in C# application. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!