System.Decimal.Add Method

Adds two specified decimal values.

Syntax

public static decimal Add (decimal d1, decimal d2)

Parameters

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

Returns

The sum of d1 and d2.

Exceptions

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

Remarks

The following code sample illustrates the use of Add :

code reference: Decimal Example#5

Requirements

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