public static void Main()
Console.WriteLine("Foo one AND Foo two");
bool a = one.Equals(two);
Console.WriteLine("Foo one AND object three (which is still Foo)");
bool c = one.Equals(three);
Console.WriteLine("object three (which is still Foo) AND Foo two");
bool e = three.Equals(one);
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);