BigInteger.Add Method (BigInteger, BigInteger)


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

Adds two BigInteger values and returns the result.

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

public static BigInteger Add(
	BigInteger left,
	BigInteger right


Type: System.Numerics.BigInteger

The first value to add.

Type: System.Numerics.BigInteger

The second value to add.

Return Value

Type: System.Numerics.BigInteger

The sum of left and right.

Languages that do not support operator overloading or custom operators can use the Add method to perform addition using BigInteger values.

The Add method is a useful substitute for the addition operator when instantiating a BigInteger variable by assigning it a sum that results from addition, as shown in the following example.

// The statement:
//    BigInteger number = Int64.MaxValue + Int32.MaxValue;
// produces compiler error CS0220: The operation overflows at compile time in checked mode.
// The alternative:
BigInteger number = BigInteger.Add(Int64.MaxValue, Int32.MaxValue);

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Available since 4.0
Windows Phone
Available since 8.1
Return to top