Example

using System;

namespace Samples
{
  public class ObjectSample
  {
    public static void Main()
    {
      Object o = new Object();
      Console.WriteLine("Are they equal: {0}",
                        o.Equals(new Object()));
      Console.WriteLine("Are they equal: {0}",
                        o.Equals(o));
      Console.WriteLine("GetHashcode yields {0}",
                        o.GetHashCode());
      Console.WriteLine("GetHashcode yields {0}",
                        new Object().GetHashCode());
      Console.WriteLine("o.ToString(): {0}", o.ToString());
    }
  }
}
The output is
Are they equal: False
Are they equal: True
GetHashcode yields 3
GetHashcode yields 5
o.ToString(): System.Object

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.