BigInteger.Increment(BigInteger) 运算符

定义

BigInteger 值加 1。Increments 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_Increment : System.Numerics.BigInteger -> System.Numerics.BigInteger
Public Shared op_Increment (value As BigInteger) As BigInteger

参数

value
BigInteger

要递增的值。The value to increment.

返回

BigInteger

value 参数加 1 后的值。The value of the value parameter incremented by 1.

注解

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

BigInteger number = 93843112;
Console.WriteLine(++number);               // Displays 93843113

缺少增量运算符或不支持运算符重载的某些语言(如 Visual Basic)可以直接调用 Increment 方法,如下面的示例所示。Some languages (such as Visual Basic) that lack an increment operator or do not support operator overloading can call the Increment method directly, as the following example shows.

Dim number As BigInteger = 93843112
Console.WriteLine(BigInteger.op_Increment(number))    ' Displays 93843113

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

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

适用于

另请参阅