32
Possible Duplicate:
How to format a decimal
How can I limit my decimal number so I'll get only 3 digits after the point?
e.g 2.774
Possible Duplicate:
How to format a decimal
How can I limit my decimal number so I'll get only 3 digits after the point?
e.g 2.774
To get Decimal back use Math.Round with Second parameter specifying number of decimal points.
decimal d = 54.9700M;
decimal f = (Math.Round(d, 2)); // 54.97
To Get String representation of number use .ToString() Specifiying Decimal Points as N3. Where 3 is the decimal points
decimal d = 54.9700M;
string s = number.ToString("N3"); // "54.97"