Add Method

Decimal.Add Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Adds two specified Decimal values.

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

public static decimal Add(
	decimal d1,
	decimal d2


Type: System.Decimal
A Decimal.
Type: System.Decimal
A Decimal.

Return Value

Type: System.Decimal
A Decimal value that is the sum of d1 and d2.


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;

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft