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:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.