BigInteger.Decrement(BigInteger) 运算符

定义

BigInteger 值减 1。Decrements a BigInteger value by 1.

public:
 static System::Numerics::BigInteger operator --(System::Numerics::BigInteger value);
public static System.Numerics.BigInteger operator -- (System.Numerics.BigInteger value);
static member op_Decrement : System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared op_Decrement (value As BigInteger) As BigInteger

参数

value
BigInteger

要递减的值。The value to decrement.

返回

BigInteger

value 参数减 1 后的值。The value of the value parameter decremented by 1.

注解

Decrement 方法定义 BigInteger 值的减量运算。The Decrement method defines the decrement operation for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger number = 93843112;
Console.WriteLine(--number);               // Displays 93843111

不支持自定义运算符的语言可以改为调用 Subtract 方法。Languages that do not support custom operators can call the Subtract method instead. 例如:For example:

BigInteger number1 = BigInteger.Pow(Int32.MaxValue, 2);
number1 = BigInteger.Subtract(number1, BigInteger.One);
Dim number1 As BigInteger = BigInteger.Pow(Int32.MaxValue, 2)
number1 = BigInteger.Subtract(number1, BigInteger.One)

由于 BigInteger 对象是不可变的,因此 Decrement 运算符会创建一个新的 BigInteger 对象,其值比 value表示的 BigInteger 对象小1。Because BigInteger objects are immutable, the Decrement operator creates a new BigInteger object whose value is one less than the BigInteger object represented by value. 这意味着对 Decrement 的重复调用可能会消耗大量资源。This means that repeated calls to Decrement may be expensive.

此运算符的等效方法是 BigInteger.Subtract(BigInteger, BigInteger)The equivalent method for this operator is BigInteger.Subtract(BigInteger, BigInteger).

适用于

另请参阅