System.Decimal.op_Addition Method

Adds two specified decimal values.

Syntax

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

Parameters

d1
The first value to add.
d2
The second value to add.

Returns

The result of adding d1 and d2.

Exceptions

TypeReason
OverflowExceptionThe sum of d1 and d2 is greater than decimal.MaxValue or less than decimal.MinValue.

Remarks

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

code reference: System.Decimal.Operators#3

If the language you're using doesn't support custom operators, call the decimal.Add(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