C# .NET - how to close or exit a console application???
Asked By jason smith on 07-Jul-06 12:35 PM
Based on the result of my checking, I would like to exit out from the console application decently without throwing any exceptions.
static void Main(string args)
//Check to see if today is a US Holiday.
//close the program and how to do that?
The application will exit by itself
Asked By Peter Bromberg on 07-Jul-06 12:42 PM
as soon as the closing brace of the Main method is reached - unless you put something in there that is a blocking call, such as Console.ReadLine (block until keyboard entry) or Thread.Sleep( timeout) (blocks until thread times out).
Does that help?
Asked By Sushila Patel on 07-Jul-06 12:55 PM
You have Environment.Exit/Application.Exit
Below link shows differences