BigInteger::Equals Method (Int64)
.NET Framework (current version)
Returns a value that indicates whether the current instance and a signed 64-bit integer have the same value.
Assembly: System.Numerics (in System.Numerics.dll)
Parameters
- other
-
Type:
System::Int64
The signed 64-bit integer value to compare.
Return Value
Type: System::Booleantrue if the signed 64-bit integer and the current instance have the same value; otherwise, false.
The following example instantiates a BigInteger object from each integral type except UInt64. It then calls the Equals(Int64) method to compare the BigInteger value with the original integer value that was passed to the BigInteger constructor. As the output shows, the values are equal in each case.
#using <System.Numerics.dll> using namespace System; using namespace System::Numerics; void main() { BigInteger bigIntValue; Byte byteValue = 16; bigIntValue = BigInteger(byteValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, byteValue.GetType()->Name, byteValue, bigIntValue.Equals((Int64)byteValue)); SByte sbyteValue = -16; bigIntValue = BigInteger(sbyteValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, sbyteValue.GetType()->Name, sbyteValue, bigIntValue.Equals((Int64)sbyteValue)); Int16 shortValue = 1233; bigIntValue = BigInteger(shortValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, shortValue.GetType()->Name, shortValue, bigIntValue.Equals((Int64)shortValue)); UInt16 ushortValue = 64000; bigIntValue = BigInteger(ushortValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, ushortValue.GetType()->Name, ushortValue, bigIntValue.Equals((Int64)ushortValue)); int intValue = -1603854; bigIntValue = BigInteger(intValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, intValue.GetType()->Name, intValue, bigIntValue.Equals((Int64)intValue)); UInt32 uintValue = 1223300; bigIntValue = BigInteger(uintValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, uintValue.GetType()->Name, uintValue, bigIntValue.Equals((Int64)uintValue)); Int64 longValue = -123822229012; bigIntValue = BigInteger(longValue); Console::WriteLine("{0} {1} = {2} {3} : {4}", bigIntValue.GetType()->Name, bigIntValue, longValue.GetType()->Name, longValue, bigIntValue.Equals((Int64)longValue)); } /* The example displays output like the following: BigInteger 16 = Byte 16 : True BigInteger -16 = SByte -16 : True BigInteger 1233 = Int16 1233 : True BigInteger 64000 = UInt16 64000 : True BigInteger -1603854 = Int32 -1603854 : True BigInteger 1223300 = UInt32 1223300 : True BigInteger -123822229012 = Int64 -123822229012 : True */
Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 4.0
Windows Phone
Available since 8.1
Show: