Tag Archives: c#

Overloading == in C#

When overriding the == operator on immutable objects, I’ve previously done something akin to public static bool operator ==(MyThing x, MyThing y){    // Null tests    try {var ignore =  x.GetType(); } // Provoke NRE    catch(NullReferenceException)    {        try        {            var ignore … Continue reading

Posted in Uncategorized | Tagged | Comments Off on Overloading == in C#