This documentation is archived and is not being maintained.

UInt64.Equals Method

Returns a value indicating whether this instance is equal to a specified object.

The UInt64 type is not CLS-compliant. The CLS-compliant alternative type is Decimal. Int64 can be used when the original value is less than half of UInt64.MaxValue. For more information about CLS compliance, see What is the Common Language Specification.

[Visual Basic]
Overrides Public Function Equals( _
   ByVal obj As Object _
) As Boolean
public override bool Equals(
 object obj
public: bool Equals(
 Object* obj
public override function Equals(
   obj : Object
) : Boolean;


An object to compare with this instance.

Return Value

true if obj is an instance of UInt64 and equals the value of this instance; otherwise, false.


[Visual Basic, C#, C++] The sample demonstrates the Equals method.

[Visual Basic] 
Dim myVariable1 As UInt64 = UInt64.Parse(50)
Dim myVariable2 As UInt64 = UInt64.Parse(50)

'Display the declaring type.
Console.WriteLine(ControlChars.NewLine + "Type of 'myVariable1' is '{0}' and" +  _ 
            " value is :{1}", myVariable1.GetType().ToString(), myVariable1.ToString())
Console.WriteLine("Type of 'myVariable2' is '{0}' and" +  _ 
      " value is :{1}", myVariable2.GetType().ToString(), myVariable2.ToString())
' Compare 'myVariable1' instance with 'myVariable2' Object.
If myVariable1.Equals(myVariable2) Then
   Console.WriteLine(ControlChars.NewLine + "Structures 'myVariable1' and" +  _
               "'myVariable2' are equal")
   Console.WriteLine(ControlChars.NewLine + "Structures 'myVariable1' and" +  _ 
         "'myVariable2' are not equal")
End If

UInt64 myVariable1 = 50;
UInt64 myVariable2 = 50;

// Display the declaring type.
Console.WriteLine("\nType of 'myVariable1' is '{0}' and"+
     " value is :{1}",myVariable1.GetType(), myVariable1); 
Console.WriteLine("Type of 'myVariable2' is '{0}' and"+
     " value is :{1}",myVariable2.GetType(), myVariable2);
// Compare 'myVariable1' instance with 'myVariable2' Object.
if( myVariable1.Equals( myVariable2 ) )
   Console.WriteLine( "\nStructures 'myVariable1' and "+
         "'myVariable2' are equal");
   Console.WriteLine( "\nStructures 'myVariable1' and "+
         "'myVariable2' are not equal");

UInt64 myVariable1 = 50;
UInt64 myVariable2 = 50;

// Display the declaring type.
Console::WriteLine(S"\nType of 'myVariable1' is '{0}' and  value is : {1}", __box(myVariable1)->GetType(), __box(myVariable1));
Console::WriteLine(S"Type of 'myVariable2' is '{0}' and  value is : {1}", __box(myVariable2)->GetType(), __box(myVariable2));
// Compare 'myVariable1' instance with 'myVariable2' Object.
if (__box(myVariable1)->Equals(__box(myVariable2)))
   Console::WriteLine(S"\nStructures 'myVariable1' and 'myVariable2' are equal");
   Console::WriteLine(S"\nStructures 'myVariable1' and 'myVariable2' are not equal");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

UInt64 Structure | UInt64 Members | System Namespace | CompareTo