try{
stringValue = intValue.ToString();
intValue = Int32.Parse(stringValue);
}
catch
{
MessageBox.Show("Error");
}
stringValue = intValue.ToString();
intValue = Int32.Parse(stringValue);
}
catch
{
MessageBox.Show("Error");
}
int i=int.Parse("1234"); 相反: string st=i.ToString(); :)
第一种:如上所说,用int.parse(stringValue);
第二种:System.Convert.toInt32(stringValue);
以上两种方式均可以达到目的。
string s;
int i;
s=Convert.ToString(n);
i=Convert.ToInt32(s);