C# transfer value from string to int

来源:互联网 发布:免费刷空间访客软件 编辑:程序博客网 时间:2024/05/10 14:18

string strValue = "123";
int intValue = int.Parse(strValue);

 

or

 

string strValue = "123";

int intValue;
int outValue = 0;
if (int.TryParse(strValue, out outValue))
{
    intValue = outValue;
}