กำหนดสตริง:
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);
}
}
กำหนดสตริง:
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);
}
}