Hi everyone.....
I have a very basic and probably stupid question.
I am just learning C# using the C#Express software and have a problem trying to view the output of my console apps. I have started a console app project, compiled and run. I see a brief flash and then the app closes and terminates.
Q. How can I prevent the console closing down so that i can actually see somthing.

View console app before termination
Pablo Orte
You could make the console app sit there until a certain key is pressed:
while ( KeepRunning == true ) { }
Then just make a method that waits for CTRL + X. when the keys are pressed you can just do: KeepRunning = false, then the while condition will finish and the app will close! Proberly not the solution you need, but it works and can be useful for running threads or logic until the user does something!
Jason Zhang
Hi
Just press the Ctl + F5
to see in the console application screen. It will start ur app without debuging.
ajliaks
In such cases I am a big fan of simply putting the following at the end of my main function to block it from quitting before I want:
Console.WriteLine("Press Return To Continue");
Console.ReadLine();
Another thing you could do would be to run the your application from the command line, however doing so there takes a tab bit more work and it's not as easy to have the debugger attached.
Tim Anderson
I'm sad to say that I did not know Control-F5 kept the screen up like that and had always assumed that it worked the same as F5 for what happens after the console app has finished running.
Live and learn.
pdns
Thankyou all for the replies
....
Akbar and Grant I like both your solutions, thanks once again for the fast and accurate replies to my problem. Both these solutions worked.
Adam i am just starting out with c# so i could not fully understand your solution, which may well work, but i am not that advanced yet. thanks anyway.