[C#]四捨五入

摘要:[C#]四捨五入

SQL寫久了,就會很直覺的聯想到ROUND函數,沒想到C#的ROUND是「銀行家捨入法」......

不管那是啥了,C#四捨五入語法如下:

Math.Round(A,B,MidpointRounding.AwayFromZero)

A=欲四捨五入的Double值
B=四捨五入至第幾位

參考資料:http://msdn.microsoft.com/zh-tw/library/f5898377(VS.80).aspx">http://msdn.microsoft.com/zh-tw/library/f5898377(VS.80).aspx