BigInteger.Subtract(BigInteger, BigInteger) Метод

Определение

Вычитает одно BigInteger значение из другого и возвращает результат.

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

Параметры

left
BigInteger

Значение для вычитания из (minuend).

right
BigInteger

Значение для вычитания (подтраченного).

Возвращаемое значение

Результат вычитания right из left.

Комментарии

Языки, которые не поддерживают пользовательские операторы, могут использовать Subtract метод для вычитания с помощью BigInteger значений.

Метод Subtract является полезным заменой оператора вычитания при создании экземпляра BigInteger переменной, назначив ему разницу, которая приводит к вычитанию, как показано в следующем примере.

// The statement
//    BigInteger number = Int64.MinValue - Int64.MaxValue;
// produces compiler error CS0220: The operation overflows at compile time in checked mode.
// The alternative:
BigInteger number = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue);
let number = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue);
' The statement
'    Dim number As BigInteger = Int64.MinValue - Int64.MaxValue
' produces compiler error BC30439: Constant expression not representable in type 'Long'.
' The alternative:
Dim number As BigInteger = BigInteger.Subtract(Int64.MinValue, Int64.MaxValue)

Применяется к

См. также раздел