1 out of 2 rated this helpful - Rate this topic

BigInteger.Add Method

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);


.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.