Winforms: Application.Exit vs Environment.Exit vs Form.Close

后端 未结 3 834
北荒
北荒 2020-11-28 22:57

Following are the ways by which we can exit an application:

  1. Environment.Exit(0)
  2. Application.Exit()
  3. Form.Close
3条回答
  •  眼角桃花
    2020-11-29 00:00

    they are all fine. but form.Close() won't close your application it closes the form and after that the main-method returns an int (exitcode).

    if you want that your application exits with exitcodes use Environmet.Exit(exitcode) or return the exitcode in the main-method

提交回复
热议问题