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

你可能感兴趣的:(“菜鸟”用asp.net做项目)