Math.Round(45.367,2) //Returns 45.37
Math.Round(45.365,2) //Returns 45.36
C#中的Round()不是咱們中國人理解的四捨五入,是老外的四捨五入,是符合IEEE標準的四捨五入,具體是四捨六入,下面的纔是符合中國人理解的四捨五入
Math.Round(45.367,2,MidpointRounding.AwayFromZero); //Returns 45.37
Math.Round(45.365,2,MidpointRounding.AwayFromZero) //Returns 45.37 ci
或im
Decimal.Round(Convert.ToDecimal (45.365),2,MidpointRounding.AwayFromZero) //45.37 di