C# PROGRAMMING

Closing Your Application

Article by:
Date Published:
Last Modified:

WPF

A common way to close the application is to use the following command:

1
Application.Current.Shutdown();

However, although your main form will close, this can sometimes leave remnants (e.g. processes) running in the background. If this is happening, I have found that the following way exits everything:

1
2
3
// The parameter is an exit code, use 0 if you
// are not concerned about this.
Environment.Exit(0);

Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Tags

    comments powered by Disqus