Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Decimal.Add Method (Decimal, Decimal)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Adds two specified Decimal values.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public static decimal Add(
	decimal d1,
	decimal d2


Type: System.Decimal

The first value to add.

Type: System.Decimal

The second value to add.

Return Value

Type: System.Decimal

The sum of d1 and d2.

Exception Condition

The sum of d1 and d2 is less than MinValue or greater than MaxValue.

The following code sample illustrates the use of Add :

class PiggyBank {
	public void AddPenny() {
		MyFortune = Decimal.Add(MyFortune, .01m);

	public override string ToString() {
		return MyFortune.ToString("C")+" in piggy bank";

	protected decimal MyFortune;

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2018 Microsoft