c# application quit or exit or eviroment code example
Example 1: c# exit application
// In a console application:
Environment.Exit(0);
// In a WPF application:
Close();
Example 2: c# how to exit program
System.Environment.Exit(1);
// In a console application:
Environment.Exit(0);
// In a WPF application:
Close();
System.Environment.Exit(1);