System.Decimal.op_Subtraction Method

Subtracts two specified decimal values.

Syntax

public static decimal operator- (decimal d1, decimal d2)

Parameters

d1
The minuend.
d2
The subtrahend.

Returns

The result of subtracting d2 from d1.

Exceptions

TypeReason
OverflowExceptionThe result is greater than decimal.MaxValue or less than decimal.MinValue.

Remarks

The decimal.op_Subtraction(decimal, decimal) method defines the operation of the subtraction operator for decimal values. It enables code such as the following:

code reference: System.Decimal.Operators#21

If the language you're using doesn't support custom operators, call the decimal.Subtract(decimal, decimal) method instead.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0