c# exit console

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

Also in C#: