BigInteger.Add(BigInteger, BigInteger) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Ajoute deux BigInteger valeurs 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
Deuxième 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 Add méthode pour effectuer des ajouts à l’aide BigInteger de valeurs.
La Add méthode est un substitut utile pour l’opérateur d’ajout lors de l’instanciation d’une BigInteger variable en lui affectant une somme qui résulte de l’ajout, 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);
let 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)