BigInteger.Add(BigInteger, BigInteger) Méthode

Définition

Ajoute deux valeurs BigInteger et retourne le résultat.

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

Paramètres

left
BigInteger

Première valeur à ajouter.

right
BigInteger

Seconde valeur à ajouter.

Retours

Somme de left et right.

Remarques

Les langages qui ne prennent pas en charge la surcharge des opérateurs ou les opérateurs personnalisés peuvent utiliser la méthode pour effectuer l’ajout Add à l’aide de BigInteger valeurs.

La Add méthode est un substitut utile pour l’opérateur d’addition lors de l’instanciation d’une BigInteger variable en lui affectant une somme qui résulte de l’addition, comme illustré dans l’exemple suivant.

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

S’applique à

Voir aussi