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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version