.NET Fiddle

CSharp · Console

/Program.cs

using System;

public class Program
{
	public static void Main()
	{
		Foo one = new Foo();
		Foo two = new Foo();
		Console.WriteLine("Foo one AND Foo two");
		bool a = one.Equals(two);
		bool b = one == two;
		Console.WriteLine("Foo one AND object three (which is still Foo)");
		object three = two;
		bool c = one.Equals(three);
		bool d = one == three;
		Console.WriteLine("object three (which is still Foo) AND Foo two");
		bool e = three.Equals(one);
		bool f = three == one;
	}
}

class Foo
{
	public override bool Equals(object that){
		Console.WriteLine("Custom Equals");
		return base.Equals(that);
	}
	
	public static bool operator == (Foo lhs, Foo rhs) {
        Console.WriteLine("Custom ==");
		return object.ReferenceEquals(lhs, rhs);
    }
	
	public static bool operator != (Foo lhs, Foo rhs) {
        Console.WriteLine("Custom !=");
		return !object.ReferenceEquals(lhs, rhs);
    }
}
;