C# Decimal Decrement

Description

Decimal Decrement decrements the Decimal operand by one.

Syntax

Decimal.Decrement has the following syntax.


public static decimal operator --(
  decimal d
)

Parameters

Decimal.Decrement has the following parameters.

  • d - The value to decrement.

Returns

Decimal.Decrement method returns The value of d decremented by 1.

Example

The Addition method defines the operation of the addition operator for Decimal values. It enables code such as the following:


using System;// ww  w .j  a  v  a  2  s.c  om

public class Example
{
   public static void Main()
   {
      Decimal number = 1079.8m;
      Console.WriteLine("Original value:    {0:N}", number);
      Console.WriteLine("Decremented 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