C# How To: Convert to Convert String to Int

To convert from a string to an integer type you can use the Convert class as shown in the code snippet below. The Convert class contains a large number of static methods which allow you to convert from one type to another.


string numberString = "1985";
int number = Convert.ToInt32(numberString);
Previous
Next Post »