Windows apps
Collapse the table of content
Expand the table of content
Information
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.

BigInteger.Add Method (BigInteger, BigInteger)

 

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
)

Parameters

left
Type: System.Numerics.BigInteger

The first value to add.

right
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
Silverlight
Available since 4.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft