Monday, January 12, 2009

how to fix decimal places


Decimal.Round
method used to a specified number of decimal places.

decimal
.Round(99.2789m ,2).ToString();

Note

Without the suffix m, the number is treated as a double, thus generating a compiler error.

Output

99.28

No comments: