C# Decimal Increment
Description
Decimal Increment
increments the Decimal operand by 1.
Syntax
Decimal.Increment
has the following syntax.
public static decimal operator ++(
decimal d
)
Parameters
Decimal.Increment
has the following parameters.
d
- The value to increment.
Returns
Decimal.Increment
method returns The value of d incremented by 1.
Example
The Increment method defines the operation of the increment operator for Decimal values. It enables code such as the following:
using System;// www . j a v a 2 s. co m
public class Example
{
public static void Main()
{
Decimal number = 1079.8m;
Console.WriteLine("Original value: {0:N}", number);
Console.WriteLine("Incremented value: {0:N}", ++number);
}
}
The code above generates the following result.