c# - Reading an integer from user input -
what looking how read integer given user command line (console project). know c++ , have started down c# path. know console.readline(); takes char/string. in short looking integer version of this.
just give idea of i'm doing exactly:
console.writeline("1. add account."); console.writeline("enter choice: "); console.readline(); // needs take in int rather string or char.
i have been looking quite while this. have found lot on c not c#. did find thread, on site, suggested convert char int. i'm sure there has more direct way converting.
you can convert string integer using convert.toint32() function
int inttemp = convert.toint32(console.readline());
Comments
Post a Comment