how to close console application in c# from code code example Example: how to exit application c# console System.Environment.Exit(0); // or Environment.Exit(0);