Application.Exit();
if (System.Windows.Forms.Application.MessageLoop) { // WinForms app System.Windows.Forms.Application.Exit(); } else { // Console app System.Environment.Exit(1); }
System.Environment.Exit(1);
// In a console application: Environment.Exit(0); // In a WPF application: Close();
Use "break;" for (int i = 1; i <= 100; i++) { if (i == 5) { break; } }
private void Test(int condition) { if(condition) return; // Exit the methode // Here code if condition == false }
System.Windows.Forms.Application.ExitThread( )