日期:2014-05-19  浏览次数:20734 次

1个问题
怎么将string转为short类型?

------解决方案--------------------
short.Parse
short.TryParse
------解决方案--------------------
short sh = short.Parse( "8000 ");

or

short sh;
if (short.TryParse( "8000 ",out sh))
{
//正确转换
}
else
{
//错误
}

------解决方案--------------------
利用Convert.ToInt16( "纯数字的字符串变量 ")就可以
------解决方案--------------------
直接用这个就可以
short.Parse