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