Export (0) Print
Expand All

UInt64.Equals Method (Object)

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

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public override bool Equals(
	Object obj
)

Parameters

obj
Type: System.Object

An object to compare to this instance.

Return Value

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

The following example demonstrates the Equals method.

using System;

public class Example
{
   public static void Main()
   {
      object[] values = { (short) 10, (short) 20, 10, 20,
                          10L, 20L, 10D, 20D, (ushort) 10,
                          (ushort) 20, 10U, 20U,
                          10ul, 20ul };
      UInt64 baseValue = 20;
      String baseType = baseValue.GetType().Name;

      foreach (var value in values)
         Console.WriteLine("{0} ({1}) = {2} ({3}): {4}",
                           baseValue, baseType,
                           value, value.GetType().Name,
                           baseValue.Equals(value));

   }
}
// The example displays the following output: 
//       20 (UInt64) = 10 (Int16): False 
//       20 (UInt64) = 20 (Int16): False 
//       20 (UInt64) = 10 (Int32): False 
//       20 (UInt64) = 20 (Int32): False 
//       20 (UInt64) = 10 (Int64): False 
//       20 (UInt64) = 20 (Int64): False 
//       20 (UInt64) = 10 (Double): False 
//       20 (UInt64) = 20 (Double): False 
//       20 (UInt64) = 10 (UInt16): False 
//       20 (UInt64) = 20 (UInt16): False 
//       20 (UInt64) = 10 (UInt32): False 
//       20 (UInt64) = 20 (UInt32): False 
//       20 (UInt64) = 10 (UInt64): False 
//       20 (UInt64) = 20 (UInt64): True

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft