Most programming books will tell you to use Console.ReadKey() to pause the console, but is there a better alternative?
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You haven’t actually told us what you wish to achieve.
If you wish to stop the output until the user chooses to continue, then you’re not really going to get much better than just waiting for a key to be pressed using
Console.ReadKey.If you just want to pause the output for a certain amount of time, you can use the
Thread.Sleepmethod, which doesn’t require any human intervention.