C# Decimal Round(Decimal)
Description
Decimal Round(Decimal)
rounds a decimal value to the
nearest integer.
Syntax
Decimal.Round(Decimal)
has the following syntax.
public static decimal Round(
decimal d
)
Parameters
Decimal.Round(Decimal)
has the following parameters.
d
- A decimal number to round.
Returns
Decimal.Round(Decimal)
method returns The integer that is nearest to the d parameter. If d is halfway between two
integers, one of which is even and the other odd, the even number is returned.
Example
The following code shows how to use Decimal.Round(Decimal)
method.
using System;/*from ww w . java2 s . c o m*/
public class Example
{
public static void Main()
{
Console.WriteLine(Decimal.Round(2.3M));
}
}
The code above generates the following result.