Im working with ConsoleKeyInfo in C# but i have problems with Console.ReadKey when I try to write numbers greater than 9 in the console, for example
ConsoleKeyInfo number;
Console.Write("Write a number: ");
number = Console.ReadKey();
If i want to write 10 or 11... the console only reads the "1"
I dont wanna use Console.ReadLine because I don want to press "Enter" for each number.
Is there another way to use Console.ReadKey to wait maybe 1 second before continue?
Thanks
The best you can do is use
Console.ReadLine()
. There's no way the program will know you have finished the number.UPDATE
If you have a fixed length number (i.e. a 13-digit ISBN), you can use ReadKey, but like this: