wait for keypress

noRulez

Newcomer
Joined
Aug 2, 2002
Messages
15
Location
Kansas, God Bless America
This is my first .NET question. :)

I have started playing around with C# today. I am starting out with a console app so I can get the feel of the syntactical changes from c++ to c#. I aplogize if this has been discussed already here, but I couldn't find a post about this. My question follows: Is there a .NET way of pausing for a keypress or something at the end of the program? In c++ I usually used system("PAUSE") or an alternative. I was wondering if there is some kind of special way to do this in c#. Otherwise I get the deal where my app closes as soon as it finishes which is not helping me out too much here. Thanks in advance.

[edit]I'd like to use something other than ReadLine if possible[/edit]
 
Last edited:
I'm not sure if the built-in console class has a way to read a single key, but if it doesn't there is a ConsoleEx class written by a guy at Microsoft which offers far more things than the framework one does.

Get it here.
 
Back
Top