Get a value indicating whether this instance is equal to a specified object or UInt64 in C#

CsharpServer Side ProgrammingProgramming

To return a value indicating whether this instance is equal to a specified object or UInt64, the code is as follows −

Example

 Live Demo

using System;
public class Demo {
   public static void Main() {
      ulong val1 = 44565777;
      ulong val2 = 77878787;
      bool res = val1.Equals(val2);
      Console.WriteLine("Return value (comparison) = "+res);
      if (res)
         Console.WriteLine("val1 = val2");
      else
         Console.WriteLine("val1 != val2");
   }
}

Output

This will produce the following output −

Return value (comparison) = False
val1 != val2

Example

Let us see another example −

 Live Demo

using System;
public class Demo {
   public static void Main() {
      ulong val1 = 78796878;
      ulong val2 = 78796878;
      bool res = val1.Equals(val2);
      Console.WriteLine("Return value (comparison) = "+res);
      if (res)
         Console.WriteLine("val1 = val2");
      else
         Console.WriteLine("val1 != val2");
   }
}

Output

This will produce the following output −

Return value (comparison) = True
val1 = val2
raja
Published on 11-Dec-2019 07:35:11
Advertisements