METHOD

Math.Round (Decimal, Int32, MidpointRounding)

Rounds decimal values using an explicit midpoint convention; choose the convention required by the domain. Formatting alone does not change the stored value.

Formal Syntax & Structure

csharp syntaxcsharp
Math.Round(amount, digits, MidpointRounding.ToEven)

Working Example

Example Snippetcsharp
using System;Console.WriteLine(Math.Round(2.5m, 0, MidpointRounding.ToEven)); // 2
C# & .NET Reference