Reading an integer from user input

后端 未结 11 908
时光取名叫无心
时光取名叫无心 2020-11-22 09:44

What I am looking for is how to read an integer that was given by the user from the command line (console project). I primarily know C++ and have started down the C# path. I

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 09:54

    You can convert the string to integer using Convert.ToInt32() function

    int intTemp = Convert.ToInt32(Console.ReadLine());
    

提交回复
热议问题