C# How to close an console application with C#? code example Example: c# exit console static void Main() { //do stuff Environment.Exit(1);// exit }