BigInteger.Equality 运算符

定义

返回一个值,该值指示两个值是否相等。Returns a value that indicates whether two values are equal.

重载

Equality(Int64, BigInteger)

返回一个值,该值指示带符号长整数值与 BigInteger 值是否相等。Returns a value that indicates whether a signed long integer value and a BigInteger value are equal.

Equality(BigInteger, Int64)

返回一个值,该值指示 BigInteger 值与带符号长整数值是否相等。Returns a value that indicates whether a BigInteger value and a signed long integer value are equal.

Equality(BigInteger, BigInteger)

返回一个值,该值指示两个 BigInteger 对象的值是否相等。Returns a value that indicates whether the values of two BigInteger objects are equal.

Equality(BigInteger, UInt64)

返回一个值,该值指示 BigInteger 值与无符号长整数值是否相等。Returns a value that indicates whether a BigInteger value and an unsigned long integer value are equal.

Equality(UInt64, BigInteger)

返回一个值,该值指示无符号长整数值与 BigInteger 值是否相等。Returns a value that indicates whether an unsigned long integer value and a BigInteger value are equal.

Equality(Int64, BigInteger)

返回一个值,该值指示带符号长整数值与 BigInteger 值是否相等。Returns a value that indicates whether a signed long integer value and a BigInteger value are equal.

public:
 static bool operator ==(long left, System::Numerics::BigInteger right);
public static bool operator == (long left, System.Numerics.BigInteger right);
static member ( = ) : int64 * System.Numerics.BigInteger -> bool
Public Shared Operator == (left As Long, right As BigInteger) As Boolean

参数

left
Int64

要比较的第一个值。The first value to compare.

right
BigInteger

要比较的第二个值。The second value to compare.

返回

如果 trueleft 参数具有相同的值,则为 right;否则为 falsetrue if the left and right parameters have the same value; otherwise, false.

注解

Equality(Int64, BigInteger) 方法定义 BigInteger 值的相等比较运算。The Equality(Int64, BigInteger) method defines the equality comparison operation for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger bigNumber = BigInteger.Pow(2, 63);
long number = Int64.MaxValue;
if (number == bigNumber)
{
   // Do something...
}
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63)
Dim number As Long = Int64.MaxValue
If number = bigNumber Then
   ' Do something...
End If   

不支持自定义运算符的语言可以改为调用 BigInteger.Equals(Int64) 的实例方法。Languages that do not support custom operators can call the BigInteger.Equals(Int64) instance method instead.

如果 leftByteInt16Int32SByteUInt16UInt32 值,则在执行操作时,它将隐式转换为 Int64 值。If left is a Byte, Int16, Int32, SByte, UInt16, or UInt32 value, it is implicitly converted to an Int64 value when the operation is performed.

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

另请参阅

Equality(BigInteger, Int64)

返回一个值,该值指示 BigInteger 值与带符号长整数值是否相等。Returns a value that indicates whether a BigInteger value and a signed long integer value are equal.

public:
 static bool operator ==(System::Numerics::BigInteger left, long right);
public static bool operator == (System.Numerics.BigInteger left, long right);
static member ( = ) : System.Numerics.BigInteger * int64 -> bool
Public Shared Operator == (left As BigInteger, right As Long) As Boolean

参数

left
BigInteger

要比较的第一个值。The first value to compare.

right
Int64

要比较的第二个值。The second value to compare.

返回

如果 trueleft 参数具有相同的值,则为 right;否则为 falsetrue if the left and right parameters have the same value; otherwise, false.

注解

Equality(BigInteger, Int64) 方法定义 BigInteger 值的相等比较运算。The Equality(BigInteger, Int64) method defines the equality comparison operation for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger bigNumber = BigInteger.Pow(2, 63);
long number = Int64.MaxValue;
if (bigNumber == number)
{
   // Do something...
}   
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63)
Dim number As Long = Int64.MaxValue
If bigNumber = number Then
   ' Do something...
End If   

不支持自定义运算符的语言可以改为调用 BigInteger.Equals(Int64) 的实例方法。Languages that do not support custom operators can call the BigInteger.Equals(Int64) instance method instead.

如果 rightByteInt16Int32SByteUInt16UInt32 值,则在执行操作时,它将隐式转换为 Int64 值。If right is a Byte, Int16, Int32, SByte, UInt16, or UInt32 value, it is implicitly converted to an Int64 value when the operation is performed.

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

另请参阅

Equality(BigInteger, BigInteger)

返回一个值,该值指示两个 BigInteger 对象的值是否相等。Returns a value that indicates whether the values of two BigInteger objects are equal.

public:
 static bool operator ==(System::Numerics::BigInteger left, System::Numerics::BigInteger right);
public static bool operator == (System.Numerics.BigInteger left, System.Numerics.BigInteger right);
static member ( = ) : System.Numerics.BigInteger * System.Numerics.BigInteger -> bool
Public Shared Operator == (left As BigInteger, right As BigInteger) As Boolean

参数

left
BigInteger

要比较的第一个值。The first value to compare.

right
BigInteger

要比较的第二个值。The second value to compare.

返回

如果 trueleft 参数具有相同的值,则为 right;否则为 falsetrue if the left and right parameters have the same value; otherwise, false.

注解

Equality(BigInteger, BigInteger) 方法定义 BigInteger 值的相等运算符的运算。The Equality(BigInteger, BigInteger) method defines the operation of the equality operator for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger number1 = 945834723;
BigInteger number2 = 345145625;
BigInteger number3 = 945834723; 
Console.WriteLine(number1 == number2);             // Displays False
Console.WriteLine(number1 == number3);             // Displays True
Dim number1 As BigInteger = 945834723
Dim number2 As BigInteger = 345145625
Dim number3 As BigInteger = 945834723 
Console.WriteLine(number1 = number2)                  ' Displays False
Console.WriteLine(number1 = number3)                  ' Displays True

不支持自定义运算符的语言可以改为调用 BigInteger.Equals(BigInteger) 的实例方法。Languages that do not support custom operators can call the BigInteger.Equals(BigInteger) instance method instead.

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

另请参阅

Equality(BigInteger, UInt64)

重要

此 API 不符合 CLS。

返回一个值,该值指示 BigInteger 值与无符号长整数值是否相等。Returns a value that indicates whether a BigInteger value and an unsigned long integer value are equal.

public:
 static bool operator ==(System::Numerics::BigInteger left, System::UInt64 right);
[System.CLSCompliant(false)]
public static bool operator == (System.Numerics.BigInteger left, ulong right);
static member ( = ) : System.Numerics.BigInteger * uint64 -> bool
Public Shared Operator == (left As BigInteger, right As ULong) As Boolean

参数

left
BigInteger

要比较的第一个值。The first value to compare.

right
UInt64

要比较的第二个值。The second value to compare.

返回

如果 trueleft 参数具有相同的值,则为 right;否则为 falsetrue if the left and right parameters have the same value; otherwise, false.

属性

注解

Equality(BigInteger, UInt64) 方法定义 BigInteger 值的相等比较运算。The Equality(BigInteger, UInt64) method defines the equality comparison operation for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger bigNumber = BigInteger.Pow(2, 63) - BigInteger.One;
ulong uNumber = Int64.MaxValue & 0x7FFFFFFFFFFFFFFF;
if (bigNumber == uNumber)
{
   // Do something...
}
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63) - BigInteger.One
Dim uNumber As ULong = CULng(Int64.MaxValue And CULng(&h7FFFFFFFFFFFFFFF))
If bigNumber = uNumber Then
   ' Do something...
End If

不支持自定义运算符的语言可以改为调用 BigInteger.Equals(UInt64) 的实例方法。Languages that do not support custom operators can call the BigInteger.Equals(UInt64) instance method instead.

另请参阅

Equality(UInt64, BigInteger)

重要

此 API 不符合 CLS。

返回一个值,该值指示无符号长整数值与 BigInteger 值是否相等。Returns a value that indicates whether an unsigned long integer value and a BigInteger value are equal.

public:
 static bool operator ==(System::UInt64 left, System::Numerics::BigInteger right);
[System.CLSCompliant(false)]
public static bool operator == (ulong left, System.Numerics.BigInteger right);
static member ( = ) : uint64 * System.Numerics.BigInteger -> bool
Public Shared Operator == (left As ULong, right As BigInteger) As Boolean

参数

left
UInt64

要比较的第一个值。The first value to compare.

right
BigInteger

要比较的第二个值。The second value to compare.

返回

如果 trueleft 参数具有相同的值,则为 right;否则为 falsetrue if the left and right parameters have the same value; otherwise, false.

属性

注解

Equality(UInt64, BigInteger) 方法定义 BigInteger 值的相等比较运算。The Equality(UInt64, BigInteger) method defines the equality comparison operation for BigInteger values. 它可以实现如下所示的代码:It enables code such as the following:

BigInteger bigNumber = BigInteger.Pow(2, 63) - BigInteger.One;
ulong uNumber = Int64.MaxValue & 0x7FFFFFFFFFFFFFFF;
if (uNumber == bigNumber)
{
   // Do something...
}
Dim bigNumber As BigInteger = BigInteger.Pow(2, 63) - BigInteger.One
Dim uNumber As ULong = CULng(Int64.MaxValue And CULng(&h7FFFFFFFFFFFFFFF))
If uNumber = bigNumber Then
   ' Do something...
End If

不支持自定义运算符的语言可以改为调用 BigInteger.Equals(UInt64) 的实例方法。Languages that do not support custom operators can call the BigInteger.Equals(UInt64) instance method instead.

另请参阅

适用于