ronman38
ronman38

Reputation: 11

How do I get Visual Studio to not close terminal window when program terminates?

Is there any other way to not close the terminal window in Visual Studio when running in debug mode? I know I can "cin >> trash;" to make it wait for input, and that I could put a breakpoint in, but are these the only two ways? It seems like there should be a setting in the debug compiler settings, but I could find anything on it. Does anyone know?

Upvotes: 1

Views: 258

Answers (1)

John Saunders
John Saunders

Reputation: 161831

The simple solution is to do it yourself:

public void Main(){
    try {
        // Do your thing
    }
    catch (Exception ex) {
        Console.WriteLine(ex);
    }
    finally {
        Console.Write("ENTER to exit: ");
        Console.ReadLine();
    }
}

Upvotes: 1

Related Questions