how to close an application in c# console code example Example: c# how to exit program System.Environment.Exit(1);