Click or drag to resize
MathRound Method (Decimal, MidpointRounding)
Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static decimal Round(
	decimal d,
	MidpointRounding mode
)

Parameters

d
Type: SystemDecimal
A decimal number to be rounded.
mode
Type: SystemMidpointRounding
Specification for how to round d if it is midway between two other numbers.

Return Value

Type: Decimal
The integer nearest d. If d is halfway between two numbers, one of which is even and the other odd, then mode determines which of the two is returned.
Exceptions
ExceptionCondition
ArgumentExceptionmode is not a valid value of MidpointRounding.
OverflowExceptionThe result is outside the range of a Decimal.
See Also