Performance Tip: Prefer (((Object) x)== null) to Object.ReferenceEquals(x,null)

What’s the best way in C# to test for a null reference? It turns out that there are a few different ways of doing this correctly, and that they have different speed and code size characteristics. Consider overloading the == operator for some class Thing. A natural first attempt is as follows. public static bool […]