How To Exit or End a C Sharp (C#) Application

12-06-2012

To exit a c# program simply use following command:

Environment.Exit(int Status);

Status is the integer you return to tell the environment how your program concludes. If it executed according as expected or if it encountered any errors.

The commonly used success value is zero 0 This will mean that your program termintaes without any problems so Windows or any other environment (or a caller) will know your code has performed without a problem.

And the commonly used failure code is negative one -1


Environment.Exit(0);

Menol
ILT

This entry was posted in C#.Net and tagged , , , , . Bookmark the permalink.

0 Responses to How To Exit or End a C Sharp (C#) Application

  1. .net performance says:

    The correct command to execute a BASIC program is: RUN. If you would like to start your program at a particular point in the execution, you may use RUN [#], where [#] is the line number you would like to start execution at.
    http://www.dapfor.com/en/net-suite/net-grid/features/performance

Leave a Reply

Your email address will not be published. Required fields are marked *