Click or drag to resize
MathRound Method (Decimal, Int32)
Rounds a decimal value to a specified number of fractional digits.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
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: Decimal
The number nearest to d that contains a number of fractional digits equal to decimals.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptiondecimals is less than 0 or greater than 28.
OverflowExceptionThe result is outside the range of a Decimal.
See Also