.NET == and .Equals() + More Ways to Compare Correctly in .NET — Definitive Guide
Because .NET behaves very strangely here
Object-oriented programming languages allow you comparisons, whatever the type. Sadly, .NET does it a bit weirdly and follows strange rules.
This doesn’t make comparisons straightforward and predictable. While the
== operator acts as…