BigInteger.Add(BigInteger, BigInteger) メソッド

定義

2 つの BigInteger 値を加算し、その結果を返します。

public:
 static System::Numerics::BigInteger Add(System::Numerics::BigInteger left, System::Numerics::BigInteger right);
public static System.Numerics.BigInteger Add (System.Numerics.BigInteger left, System.Numerics.BigInteger right);
static member Add : System.Numerics.BigInteger * System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared Function Add (left As BigInteger, right As BigInteger) As BigInteger

パラメーター

left
BigInteger

加算する 1 番目の値。

right
BigInteger

加算する 2 番目の値。

戻り値

leftright の合計。

注釈

演算子のオーバーロードまたはカスタム演算子をサポートしていない言語では、 メソッドを使用して値を Add 使用して加算を BigInteger 実行できます。

メソッドは Add 、次の例に示すように、加算の結果の合計を BigInteger 代入して変数をインスタンス化するときに、加算演算子の代わりに役立ちます。

// 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);
' The statement
'    Dim number As BigInteger = Int64.MaxValue + Int32.MaxValue
' produces compiler error BC30439: Constant expression not representable in type 'Long'.
' The alternative:
Dim number As BigInteger = BigInteger.Add(Int64.MaxValue, Int32.MaxValue)

適用対象

こちらもご覧ください