exit program c# code example

Example 1: c# exit console

static void Main()
{
	//do stuff
  
	Environment.Exit(1);// exit
}

Example 2: exit programm c#

Application.Exit();

Example 3: how to exit a program in c#

Application.Exit();

Example 4: c# how to exit program

System.Environment.Exit(1);

Example 5: exit a method c#

private void Test(int condition)
{
  if(condition)
    return; // Exit the methode

  // Here code if condition == false
}

Example 6: c# program exit

System.Windows.Forms.Application.ExitThread( )

Tags:

C Example