新手啊求大神解释,满分
新手求救啊,求大神解释,满分
VS版本2015 系统win7 64.
public T ddd<T>(T b) where T:struct
{
if (typeof(T) == typeof(int))
{
double sum = Convert.ToInt32(b) / 2.00;
return (T)Convert.ChangeType(sum, typeof(double));
}
return b;
}
调用
double dd = ddd(3);
MessageBox.Show("1111");
MessageBox.Show(dd + "");
你们猜返回值是什么?
为什么会这样?求大神解释,莫非是BUG?
------解决思路----------------------
返回什么??
VS版本2015 系统win7 64.
public T ddd<T>(T b) where T:struct
{
if (typeof(T) == typeof(int))
{
double sum = Convert.ToInt32(b) / 2.00;
return (T)Convert.ChangeType(sum, typeof(double));
}
return b;
}
调用
double dd = ddd(3);
MessageBox.Show("1111");
MessageBox.Show(dd + "");
你们猜返回值是什么?
为什么会这样?求大神解释,莫非是BUG?
------解决思路----------------------
返回什么??