I have a console app in which I want to give the user x seconds to respond to the prompt. If no input is made after a certain period of time, program logic should
string readline = "?";
ThreadPool.QueueUserWorkItem(
delegate
{
readline = Console.ReadLine();
}
);
do
{
Thread.Sleep(100);
} while (readline == "?");
Note that if you go down the "Console.ReadKey" route, you lose some of the cool features of ReadLine, namely:
To add a timeout, alter the while loop to suit.