假设我们的字符串是-
string str ="9999";
现在,使用Int32.Parse()将字符串转换为整数-
int n = Int32.Parse(str);
现在显示整数值,如以下代码所示:
using System;
class Demo {
static void Main() {
string str ="9999";
int n = Int32.Parse(str);
Console.WriteLine(n);
}
}