VS.NET Bug
One of my coworkers discovered the hard way today that in C# == is not the same as .Equals(). She had something like this:
object o1 = 1; object o2 = 1; Assert.IsTrue(o1 == o2);
This fails. The really nasty thing is that the Command Window and QuickWatch show that the expression evaluates to true!
So she changed it to:
object o1 = 1; object o2 = 1; Assert.IsTrue(o1.Equals(o2));
This succeeds! Why? From the docs:
For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise. For reference types other than string, == returns true if its two operands refer to the same object. For the string type, == compares the values of the strings.
So that means strings are special, so the following should work:
object o1 = "1"; object o2 = "1"; Assert.IsTrue(o1 == o2);
And it does.