C#有这样的方法
//四舍五入
Math.Round(0.5,MidpointRounding.AwayFromZero)
注意Math.Round(一参数)的结果
Math.Round(0.4) //result:0
Math.Round(0.6) //result:1
Math.Round(0.5) //result:0
Math.Round(1.5) //result:2
Math.Round(2.5) //result:2
Math.Round(3.5) //result:4
Math.Round(5.5) //result:6
Math.Round(6.5) //result:6
Math.Round(8.5) //result:8
Math.Round(9.5) //result:10
Silverlight不支持MidpointRounding
可以用这样的方法:
double d = 0.5;
d.ToString("0");//输出1
d.ToString("0");//输出1
参考:http://topic.csdn.net/u/20100524/13/f622110b-9ea4-48b1-b11f-a1f7a00f08cc.html