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

One thought on “How To Exit or End a C Sharp (C#) Application

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: