NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

-- Operator

The decrement operator (--) decrements its operand by 1. The decrement operator can appear before or after its operand:

-- var
var --
where:
var
An expression that denotes a storage location or a property or an indexer.

Remarks

The first form is a prefix decrement operation. The result of the operation is the value of the operand after it has been decremented.

The second form is a postfix decrement operation. The result of the operation is the value of the operand before it has been decremented.

Numeric and enumeration types have predefined decrement operators. User-defined types can overload the -- operator (see operator).

Example

using System;
class Test {
   public static void Main() {
      double x;
      x = 1.5;
      Console.WriteLine(--x);
      x = 1.5;
      Console.WriteLine(x--);
      Console.WriteLine(x);
   }
}

Output

0.5
1.5
0.5

See Also

C# Operators | CLR 7.5.10 Postfix decrement operator | CLR 7.6.8 Prefix decrement operator