C#中 decimal 的四舍五入

当:decimal sum = 123456.784M;

sum = decimal.Round(sum, 2 , MidpointRounding.AwayFromZero); 

sum 的值为:123456.78

当:decimal sum = 123456.785M;

sum = decimal.Round(sum, 2 , MidpointRounding.AwayFromZero); 

sum 的值为:123456.79

posted @ 2014-06-17 11:07 TooKoo 阅读(...) 评论(...) 编辑 收藏