I have a console Application Program on Visual Studio 2013. .NET 4.5 I want the program to quit after doing a Certain task. SO, I use System.Environment.Exit(0); but it does not exit. It only displays on the console: Press any key to continue.
How can i exit the Program? Thanks in Advance.
Here iam checking if directory is empty, then exit the program, I also tried to put System.Environment.Exit(0); in the main function but it did nothing.
if (Directory.GetFiles(@"Q:\").Length == 0)
{
System.Environment.Exit(0);
}