MathRound Method (Decimal, Int32) |
Rounds a decimal value to a specified number of fractional digits.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static decimal Round(
decimal d,
int decimals
)
Parameters
- d
- Type: SystemDecimal
A decimal number to be rounded. - decimals
- Type: SystemInt32
The number of decimal places in the return value.
Return Value
Type:
DecimalThe number nearest to
d that contains a number of fractional digits equal to
decimals.
Exceptions Exception | Condition |
---|
ArgumentOutOfRangeException | decimals is less than 0 or greater than 28. |
OverflowException | The result is outside the range of a Decimal. |
See Also