.net - C# Console.ReadKey read numbers greater than 9 -


im working consolekeyinfo in c# have problems console.readkey when try write numbers greater 9 in console, example

consolekeyinfo number; console.write("write number: "); number = console.readkey(); 

if want write 10 or 11... console reads "1"

i dont wanna use console.readline because don want press "enter" each number.

is there way use console.readkey wait maybe 1 second before continue?

thanks

the best can use console.readline(). there's no way program know have finished number.

update

if have fixed length number (i.e. 13-digit isbn), can use readkey, this:

string isbn = ""; while (isbn.length < 13) {     isbn += console.readkey().keychar; } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -