Suppose our string is -
string str ="9999";
Now, use Int32.Parse() to convert the string to integer -
int n = Int32.Parse(str);
Now display the integer value as shown in the following code -
using System; class Demo { static void Main() { string str ="9999"; int n = Int32.Parse(str); Console.WriteLine(n); } }
The above is the detailed content of How to convert string to int in C#?. For more information, please follow other related articles on the PHP Chinese website!