.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
Post a Comment