static void Main()
{
//do stuff
Environment.Exit(1);// exit
}
System.Environment.Exit(0);
// or
Environment.Exit(0);
// In a console application:
Environment.Exit(0);
// In a WPF application:
Close();
if (System.Windows.Forms.Application.MessageLoop)
{
// WinForms app
System.Windows.Forms.Application.Exit();
}
else
{
// Console app
System.Environment.Exit(1);
}
System.Envrionment.Exit(0);
//or
Envrionment.Exit(0);