What is Convert.ToInt32(Console.ReadLine()) Method In C#

Partho Sarathi

28 Oct, 2007 · 1 minute read

  • Share:

The method Console.ReadLinealways reads the input from the user in the form of a string. To get an integer value from the user, this string needs to be converted to Integer. The Convert.ToInt32does this.

Example Code:-

Console.WriteLine("Please enter a number");
int Num = Convert.ToInt32(Console.ReadLine());
  • Share:

The cleanest blogging platform


2024 © Maxotek. All rights reserved.