首页 > 代码库 > C#中 decimal 的四舍五入

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