# BigIntegerBigIntegerBigIntegerBigInteger Struct

## 定义

public value class BigInteger : IComparable, IComparable<System::Numerics::BigInteger>, IEquatable<System::Numerics::BigInteger>, IFormattable
[System.Serializable]
public struct BigInteger : IComparable, IComparable<System.Numerics.BigInteger>, IEquatable<System.Numerics.BigInteger>, IFormattable
type BigInteger = struct
interface IFormattable
Public Structure BigInteger
Implements IComparable, IComparable(Of BigInteger), IEquatable(Of BigInteger), IFormattable

BigIntegerBigIntegerBigIntegerBigInteger

## 注解

BigInteger类型是不可变类型，表示其值在理论上有没有上限或下限的边界的任意大整数。The BigInteger type is an immutable type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds. 成员BigInteger类型紧密几乎与其他整数类型 ( ByteInt16Int32Int64SByteUInt16UInt32，和UInt64类型)。The members of the BigInteger type closely parallel those of other integral types (the Byte, Int16, Int32, Int64, SByte, UInt16, UInt32, and UInt64 types). 此类型与其他整数类型中不同.NET Framework.NET Framework，其中包含所指示的范围及其MinValueMaxValue属性。This type differs from the other integral types in the .NET Framework.NET Framework, which have a range indicated by their MinValue and MaxValue properties.

### 实例化 BigInteger 对象Instantiating a BigInteger Object

• 可以使用new关键字，并作为参数提供的任何整型或浮点值BigInteger构造函数。You can use the new keyword and provide any integral or floating-point value as a parameter to the BigInteger constructor. (浮点值将被截断之前分配给BigInteger。)下面的示例演示如何使用new关键字来实例化BigInteger值。(Floating-point values are truncated before they are assigned to the BigInteger.) The following example illustrates how to use the new keyword to instantiate BigInteger values.

BigInteger bigIntFromDouble = new BigInteger(179032.6541);
Console.WriteLine(bigIntFromDouble);
BigInteger bigIntFromInt64 = new BigInteger(934157136952);
Console.WriteLine(bigIntFromInt64);
// The example displays the following output:
//   179032
//   934157136952

Dim bigIntFromDouble As New BigInteger(179032.6541)
Console.WriteLine(bigIntFromDouble)
Dim bigIntFromInt64 As New BigInteger(934157136952)
Console.WriteLine(bigIntFromInt64)
' The example displays the following output:
'   179032
'   934157136952

• 您可以声明BigInteger变量并将分配一个值，就像您一样任何数值类型，前提是该值是一种整型类型。You can declare a BigInteger variable and assign it a value just as you would any numeric type, as long as that value is an integral type. 下面的示例使用分配来创建BigInteger值从Int64The following example uses assignment to create a BigInteger value from an Int64.

long longValue = 6315489358112;
BigInteger assignedFromLong = longValue;
Console.WriteLine(assignedFromLong);
// The example displays the following output:
//   6315489358112

Dim longValue As Long = 6315489358112
Dim assignedFromLong As BigInteger = longValue
Console.WriteLine(assignedFromLong)
' The example displays the following output:
'   6315489358112

• 可以将分配到的十进制或浮点值BigInteger对象，如果将值强制转换或首先将其转换。You can assign a decimal or floating-point value to a BigInteger object if you cast the value or convert it first. 下面的示例显式强制转换 （在 C# 中) 或 （在 Visual Basic) 将转换Double和一个Decimal值设为BigIntegerThe following example explicitly casts (in C#) or converts (in Visual Basic) a Double and a Decimal value to a BigInteger.

BigInteger assignedFromDouble = (BigInteger) 179032.6541;
Console.WriteLine(assignedFromDouble);
BigInteger assignedFromDecimal = (BigInteger) 64312.65m;
Console.WriteLine(assignedFromDecimal);
// The example displays the following output:
//   179032
//   64312

Dim assignedFromDouble As BigInteger = CType(179032.6541, BigInteger)
Console.WriteLine(assignedFromDouble)
Dim assignedFromDecimal As BigInteger = CType(64312.65d, BigInteger)
Console.WriteLine(assignedFromDecimal)
' The example displays the following output:
'   179032
'   64312

• 可以使用new关键字，并提供到任意大小的字节数组BigInteger.BigInteger构造函数。You can use the new keyword and provide a byte array of any size to the BigInteger.BigInteger constructor. 例如:For example:

byte[] byteArray = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
BigInteger newBigInt = new BigInteger(byteArray);
Console.WriteLine("The value of newBigInt is {0} (or 0x{0:x}).", newBigInt);
// The example displays the following output:
//   The value of newBigInt is 4759477275222530853130 (or 0x102030405060708090a).

Dim byteArray() As Byte = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
Dim newBigInt As New BigInteger(byteArray)
Console.WriteLine("The value of newBigInt is {0} (or 0x{0:x}).", newBigInt)
' The example displays the following output:
'   The value of newBigInt is 4759477275222530853130 (or 0x102030405060708090a).

• 您可以调用ParseTryParse方法将转换到的数字的字符串表示形式BigIntegerYou can call the Parse or TryParse methods to convert the string representation of a number to a BigInteger. 例如:For example:

string positiveString = "91389681247993671255432112000000";
string negativeString = "-90315837410896312071002088037140000";
BigInteger posBigInt = 0;
BigInteger negBigInt = 0;

try {
posBigInt = BigInteger.Parse(positiveString);
Console.WriteLine(posBigInt);
}
catch (FormatException)
{
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.",
positiveString);
}

if (BigInteger.TryParse(negativeString, out negBigInt))
Console.WriteLine(negBigInt);
else
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.",
negativeString);

// The example displays the following output:
//   9.1389681247993671255432112E+31
//   -9.0315837410896312071002088037E+34

Dim positiveString As String = "91389681247993671255432112000000"
Dim negativeString As string = "-90315837410896312071002088037140000"
Dim posBigInt As BigInteger = 0
Dim negBigInt As BigInteger = 0

Try
posBigInt = BigInteger.Parse(positiveString)
Console.WriteLine(posBigInt)
Catch e As FormatException
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.", _
positiveString)
End Try

If BigInteger.TryParse(negativeString, negBigInt) Then
Console.WriteLine(negBigInt)
Else
Console.WriteLine("Unable to convert the string '{0}' to a BigInteger value.", _
negativeString)
End If
' The example displays the following output:
'   9.1389681247993671255432112E+31
'   -9.0315837410896312071002088037E+34

• 您可以调用static(Shared在 Visual Basic 中)BigInteger方法，用于对数值表达式执行某种操作并返回计算BigInteger结果。You can call a static (Shared in Visual Basic) BigInteger method that performs some operation on a numeric expression and returns a calculated BigInteger result. 下面的示例执行此通过多维UInt64.MaxValue并将分配到结果BigIntegerThe following example does this by cubing UInt64.MaxValue and assigning the result to a BigInteger.

BigInteger number = BigInteger.Pow(UInt64.MaxValue, 3);
Console.WriteLine(number);
// The example displays the following output:
//    6277101735386680762814942322444851025767571854389858533375

Dim number As BigInteger = BigInteger.Pow(UInt64.MaxValue, 3)
Console.WriteLine(number)
' The example displays the following output:
' 6277101735386680762814942322444851025767571854389858533375

### 可变性和 BigInteger 结构Mutability and the BigInteger Structure

BigInteger number = BigInteger.Multiply(Int64.MaxValue, 3);
number++;
Console.WriteLine(number);
Dim number As BigInteger = BigInteger.Multiply(Int64.MaxValue, 3)
number += 1
Console.WriteLine(number)

.NET Framework 中的其他数字类型也是不可变的。The other numeric types in the .NET Framework are also immutable. 但是，因为BigInteger类型具有无上限或下限的边界，其值可以变得非常大并对性能产生明显的影响。However, because the BigInteger type has no upper or lower bounds, its values can grow extremely large and have a measurable impact on performance.

BigInteger number = Int64.MaxValue ^ 5;
int repetitions = 1000000;
// Perform some repetitive operation 1 million times.
for (int ctr = 0; ctr <= repetitions; ctr++)
{
// Perform some operation. If it fails, exit the loop.
if (! SomeOperationSucceeds()) break;
// The following code executes if the operation succeeds.
number++;
}
Dim number As BigInteger = Int64.MaxValue ^ 5
Dim repetitions As Integer = 1000000
' Perform some repetitive operation 1 million times.
For ctr As Integer = 0 To repetitions
' Perform some operation. If it fails, exit the loop.
If Not SomeOperationSucceeds() Then Exit For
' The following code executes if the operation succeeds.
number += 1
Next

BigInteger number = Int64.MaxValue ^ 5;
int repetitions = 1000000;
int actualRepetitions = 0;
// Perform some repetitive operation 1 million times.
for (int ctr = 0; ctr <= repetitions; ctr++)
{
// Perform some operation. If it fails, exit the loop.
if (! SomeOperationSucceeds()) break;
// The following code executes if the operation succeeds.
actualRepetitions++;
}
number += actualRepetitions;
Dim number As BigInteger = Int64.MaxValue ^ 5
Dim repetitions As Integer = 1000000
Dim actualRepetitions As Integer = 0
' Perform some repetitive operation 1 million times.
For ctr As Integer = 0 To repetitions
' Perform some operation. If it fails, exit the loop.
If Not SomeOperationSucceeds() Then Exit For
' The following code executes if the operation succeeds.
actualRepetitions += 1
Next
number += actualRepetitions

### 使用字节数组和十六进制字符串Working with Byte Arrays and Hexadecimal Strings

BigInteger number = BigInteger.Pow(Int64.MaxValue, 2);
Console.WriteLine(number);

// Write the BigInteger value to a byte array.
byte[] bytes = number.ToByteArray();

// Display the byte array.
foreach (byte byteValue in bytes)
Console.Write("0x{0:X2} ", byteValue);
Console.WriteLine();

// Restore the BigInteger value from a Byte array.
BigInteger newNumber = new BigInteger(bytes);
Console.WriteLine(newNumber);
// The example displays the following output:
//    8.5070591730234615847396907784E+37
//    0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x3F
//
//    8.5070591730234615847396907784E+37
Dim number As BigInteger = BigInteger.Pow(Int64.MaxValue, 2)
Console.WriteLine(number)

' Write the BigInteger value to a byte array.
Dim bytes() As Byte = number.ToByteArray()

' Display the byte array.
For Each byteValue As Byte In bytes
Console.Write("0x{0:X2} ", byteValue)
Next
Console.WriteLine()

' Restore the BigInteger value from a Byte array.
Dim newNumber As BigInteger = New BigInteger(bytes)
Console.WriteLine(newNumber)
' The example displays the following output:
'    8.5070591730234615847396907784E+37
'    0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x3F
'
'    8.5070591730234615847396907784E+37

short originalValue = 30000;
Console.WriteLine(originalValue);

// Convert the Int16 value to a byte array.
byte[] bytes = BitConverter.GetBytes(originalValue);

// Display the byte array.
foreach (byte byteValue in bytes)
Console.Write("0x{0} ", byteValue.ToString("X2"));
Console.WriteLine();

// Pass byte array to the BigInteger constructor.
BigInteger number = new BigInteger(bytes);
Console.WriteLine(number);
// The example displays the following output:
//       30000
//       0x30 0x75
//       30000
Dim originalValue As Short = 30000
Console.WriteLine(originalValue)

' Convert the Int16 value to a byte array.
Dim bytes() As Byte = BitConverter.GetBytes(originalValue)

' Display the byte array.
For Each byteValue As Byte In bytes
Console.Write("0x{0} ", byteValue.ToString("X2"))
Next
Console.WriteLine()

' Pass byte array to the BigInteger constructor.
Dim number As BigInteger = New BigInteger(bytes)
Console.WriteLine(number)
' The example displays the following output:
'       30000
'       0x30 0x75
'       30000

BigInteger结构假定负值会存储通过使用 2 的补数表示。The BigInteger structure assumes that negative values are stored by using two's complement representation. 因为BigInteger结构表示没有固定的长度，值的数值BigInteger(Byte[])构造函数始终解释为符号位数组中的最后一个字节的最高有效位。Because the BigInteger structure represents a numeric value with no fixed length, the BigInteger(Byte[]) constructor always interprets the most significant bit of the last byte in the array as a sign bit. 若要防止BigInteger(Byte[])让人迷惑不解的 2 的补数表示的值为负正是正数值的符号和量值表示形式的构造函数中的值的最高有效位的字节数组中的最后一个字节通常为集应包含额外的字节，其值为 0。To prevent the BigInteger(Byte[]) constructor from confusing the two's complement representation of a negative value with the sign and magnitude representation of a positive value, positive values in which the most significant bit of the last byte in the byte array would ordinarily be set should include an additional byte whose value is 0. 例如，0xC0 0xBD 0xF0 0xFF 是 1000000 或 4293967296 的小字节序十六进制表示形式。For example, 0xC0 0xBD 0xF0 0xFF is the little-endian hexadecimal representation of either -1,000,000 or 4,293,967,296. 此数组中的最后一个字节的最高有效位是打开的因为将通过解释的字节数组值BigInteger(Byte[])为-1000000 的构造函数。Because the most significant bit of the last byte in this array is on, the value of the byte array would be interpreted by the BigInteger(Byte[]) constructor as -1,000,000. 若要实例化BigInteger其值为正，字节数组，其元素是 0xC0 0xBD 0xF0 0xFF 0x00 必须传递给构造函数。To instantiate a BigInteger whose value is positive, a byte array whose elements are 0xC0 0xBD 0xF0 0xFF 0x00 must be passed to the constructor. 下面的示例阐释了这一点。The following example illustrates this.

int negativeNumber = -1000000;
uint positiveNumber = 4293967296;

byte[] negativeBytes = BitConverter.GetBytes(negativeNumber);
BigInteger negativeBigInt = new BigInteger(negativeBytes);
Console.WriteLine(negativeBigInt.ToString("N0"));

byte[] tempPosBytes = BitConverter.GetBytes(positiveNumber);
byte[] positiveBytes = new byte[tempPosBytes.Length + 1];
Array.Copy(tempPosBytes, positiveBytes, tempPosBytes.Length);
BigInteger positiveBigInt = new BigInteger(positiveBytes);
Console.WriteLine(positiveBigInt.ToString("N0"));
// The example displays the following output:
//    -1,000,000
//    4,293,967,296
Dim negativeNumber As Integer = -1000000
Dim positiveNumber As UInteger = 4293967296

Dim negativeBytes() As Byte = BitConverter.GetBytes(negativeNumber)
Dim negativeBigInt As New BigInteger(negativeBytes)
Console.WriteLine(negativeBigInt.ToString("N0"))

Dim tempPosBytes() As Byte = BitConverter.GetBytes(positiveNumber)
Dim positiveBytes(tempposBytes.Length) As Byte
Array.Copy(tempPosBytes, positiveBytes, tempPosBytes.Length)
Dim positiveBigInt As New BigInteger(positiveBytes)
Console.WriteLine(positiveBigInt.ToString("N0"))
' The example displays the following output:
'    -1,000,000
'    4,293,967,296

BigInteger positiveValue = 15777216;
BigInteger negativeValue  = -1000000;

Console.WriteLine("Positive value: " + positiveValue.ToString("N0"));
byte[] bytes = positiveValue.ToByteArray();

foreach (byte byteValue in bytes)
Console.Write("{0:X2} ", byteValue);
Console.WriteLine();
positiveValue = new BigInteger(bytes);
Console.WriteLine("Restored positive value: " + positiveValue.ToString("N0"));

Console.WriteLine();

Console.WriteLine("Negative value: " + negativeValue.ToString("N0"));
bytes = negativeValue.ToByteArray();
foreach (byte byteValue in bytes)
Console.Write("{0:X2} ", byteValue);
Console.WriteLine();
negativeValue = new BigInteger(bytes);
Console.WriteLine("Restored negative value: " + negativeValue.ToString("N0"));
// The example displays the following output:
//       Positive value: 15,777,216
//       C0 BD F0 00
//       Restored positive value: 15,777,216
//
//       Negative value: -1,000,000
//       C0 BD F0
//       Restored negative value: -1,000,000
Dim positiveValue As BigInteger = 15777216
Dim negativeValue As BigInteger = -1000000

Console.WriteLine("Positive value: " + positiveValue.ToString("N0"))
Dim bytes() As Byte = positiveValue.ToByteArray()
For Each byteValue As Byte In bytes
Console.Write("{0:X2} ", byteValue)
Next
Console.WriteLine()
positiveValue = New BigInteger(bytes)
Console.WriteLine("Restored positive value: " + positiveValue.ToString("N0"))

Console.WriteLine()

Console.WriteLIne("Negative value: " + negativeValue.ToString("N0"))
bytes = negativeValue.ToByteArray()
For Each byteValue As Byte In bytes
Console.Write("{0:X2} ", byteValue)
Next
Console.WriteLine()
negativeValue = New BigInteger(bytes)
Console.WriteLine("Restored negative value: " + negativeValue.ToString("N0"))
' The example displays the following output:
'       Positive value: 15,777,216
'       C0 BD F0 00
'       Restored positive value: 15,777,216
'
'       Negative value: -1,000,000
'       C0 BD F0
'       Restored negative value: -1,000,000

BigInteger negativeNumber = -1000000;
BigInteger positiveNumber  = 15777216;

string negativeHex = negativeNumber.ToString("X");
string positiveHex = positiveNumber.ToString("X");

BigInteger negativeNumber2, positiveNumber2;
negativeNumber2 = BigInteger.Parse(negativeHex,
NumberStyles.HexNumber);
positiveNumber2 = BigInteger.Parse(positiveHex,
NumberStyles.HexNumber);

Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
negativeNumber, negativeHex, negativeNumber2);
Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
positiveNumber, positiveHex, positiveNumber2);
// The example displays the following output:
//       Converted -1,000,000 to F0BDC0 back to -1,000,000.
//       Converted 15,777,216 to 0F0BDC0 back to 15,777,216.
Dim negativeNumber As BigInteger = -1000000
Dim positiveNumber As BigInteger = 15777216

Dim negativeHex As String = negativeNumber.ToString("X")
Dim positiveHex As string = positiveNumber.ToString("X")

Dim negativeNumber2, positiveNumber2 As BigInteger
negativeNumber2 = BigInteger.Parse(negativeHex,
NumberStyles.HexNumber)
positiveNumber2 = BigInteger.Parse(positiveHex,
NumberStyles.HexNumber)

Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
negativeNumber, negativeHex, negativeNumber2)
Console.WriteLine("Converted {0:N0} to {1} back to {2:N0}.",
positiveNumber, positiveHex, positiveNumber2)
' The example displays the following output:
'       Converted -1,000,000 to F0BDC0 back to -1,000,000.
'       Converted 15,777,216 to 0F0BDC0 back to 15,777,216.

using System;
using System.Globalization;
using System.Numerics;

public struct HexValue
{
public int Sign;
public string Value;
}

public class Example
{
public static void Main()
{
uint positiveNumber = 4039543321;
int negativeNumber = -255423975;

// Convert the numbers to hex strings.
HexValue hexValue1, hexValue2;
hexValue1.Value = positiveNumber.ToString("X");
hexValue1.Sign = Math.Sign(positiveNumber);

hexValue2.Value = Convert.ToString(negativeNumber, 16);
hexValue2.Sign = Math.Sign(negativeNumber);

// Round-trip the hexadecimal values to BigInteger values.
string hexString;
BigInteger positiveBigInt, negativeBigInt;

hexString = (hexValue1.Sign == 1 ? "0" : "") + hexValue1.Value;
positiveBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber);
Console.WriteLine("Converted {0} to {1} and back to {2}.",
positiveNumber, hexValue1.Value, positiveBigInt);

hexString = (hexValue2.Sign == 1 ? "0" : "") + hexValue2.Value;
negativeBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber);
Console.WriteLine("Converted {0} to {1} and back to {2}.",
negativeNumber, hexValue2.Value, negativeBigInt);
}
}
// The example displays the following output:
//       Converted 4039543321 to F0C68A19 and back to 4039543321.
//       Converted -255423975 to f0c68a19 and back to -255423975.
Imports System.Globalization
Imports System.Numerics

Public Structure HexValue
Public Sign As Integer
Public Value As String
End Structure

Module Example
Public Sub Main()
Dim positiveNumber As UInteger = 4039543321
Dim negativeNumber As Integer = -255423975

' Convert the numbers to hex strings.
Dim hexValue1, hexValue2 As HexValue
hexValue1.Value = positiveNumber.ToString("X")
hexValue1.Sign = Math.Sign(positiveNumber)

hexValue2.Value = Convert.ToString(negativeNumber, 16)
hexValue2.Sign = Math.Sign(negativeNumber)

' Round-trip the hexadecimal values to BigInteger values.
Dim hexString As String
Dim positiveBigInt, negativeBigInt As BigInteger

hexString = CStr(IIf(hexValue1.Sign = 1, "0", "")) + hexValue1.Value
positiveBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber)
Console.WriteLine("Converted {0} to {1} and back to {2}.",
positiveNumber, hexValue1.Value, positiveBigInt)

hexString = CStr(IIf(hexValue2.Sign = 1, "0", "")) + hexValue2.Value
negativeBigInt = BigInteger.Parse(hexString, NumberStyles.HexNumber)
Console.WriteLine("Converted {0} to {1} and back to {2}.",
negativeNumber, hexValue2.Value, negativeBigInt)

End Sub
End Module
' The example displays the following output:
'       Converted 4039543321 to F0C68A19 and back to 4039543321.
'       Converted -255423975 to f0c68a19 and back to -255423975.

## 构造函数

 BigInteger(Byte[]) BigInteger(Byte[]) BigInteger(Byte[]) BigInteger(Byte[]) 使用字节数组中的值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using the values in a byte array. BigInteger(Decimal) BigInteger(Decimal) BigInteger(Decimal) BigInteger(Decimal) 使用 BigInteger 值初始化 Decimal 结构的新实例。Initializes a new instance of the BigInteger structure using a Decimal value. BigInteger(Double) BigInteger(Double) BigInteger(Double) BigInteger(Double) 使用双精度浮点值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using a double-precision floating-point value. BigInteger(Int32) BigInteger(Int32) BigInteger(Int32) BigInteger(Int32) 使用 32 位带符号整数值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using a 32-bit signed integer value. BigInteger(Int64) BigInteger(Int64) BigInteger(Int64) BigInteger(Int64) 使用 64 位带符号整数值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using a 64-bit signed integer value. BigInteger(Single) BigInteger(Single) BigInteger(Single) BigInteger(Single) 使用单精度浮点值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using a single-precision floating-point value. BigInteger(UInt32) BigInteger(UInt32) BigInteger(UInt32) BigInteger(UInt32) 使用 32 位无符号整数值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure using an unsigned 32-bit integer value. BigInteger(UInt64) BigInteger(UInt64) BigInteger(UInt64) BigInteger(UInt64) 使用 64 位无符号整数值初始化 BigInteger 结构的新实例。Initializes a new instance of the BigInteger structure with an unsigned 64-bit integer value. BigInteger(ReadOnlySpan, Boolean, Boolean) BigInteger(ReadOnlySpan, Boolean, Boolean) BigInteger(ReadOnlySpan, Boolean, Boolean) BigInteger(ReadOnlySpan, Boolean, Boolean)

## 属性

 IsEven IsEven IsEven IsEven 指示当前 BigInteger 对象的值是否是偶数。Indicates whether the value of the current BigInteger object is an even number. IsOne IsOne IsOne IsOne 指示当前 BigInteger 对象的值是否是 One。Indicates whether the value of the current BigInteger object is One. IsPowerOfTwo IsPowerOfTwo IsPowerOfTwo IsPowerOfTwo 指示当前 BigInteger 对象的值是否是 2 的幂。Indicates whether the value of the current BigInteger object is a power of two. IsZero IsZero IsZero IsZero 指示当前 BigInteger 对象的值是否是 Zero。Indicates whether the value of the current BigInteger object is Zero. MinusOne MinusOne MinusOne MinusOne 获取一个表示数字负一 (-1) 的值。Gets a value that represents the number negative one (-1). One One One One 获取一个表示数字一 (1) 的值。Gets a value that represents the number one (1). Sign Sign Sign Sign 获取一个数字，该数字指示当前 BigInteger 对象的符号（负、正或零）。Gets a number that indicates the sign (negative, positive, or zero) of the current BigInteger object. Zero Zero Zero Zero 获取一个表示数字 0（零）的值。Gets a value that represents the number 0 (zero).