1. 程式人生 > >C# Math.Round實現中國式四捨五入

C# Math.Round實現中國式四捨五入

decimal sum = 11111.334;

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

sum:11111.33decimal sum = 11111.345;

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

sum :11111.35