Why is (object)0 == (object)0 different from ((object)0).Equals((object)0)?

Viewed 8371

Why are the following expressions different?

[1]  (object)0 == (object)0 //false
[2]  ((object)0).Equals((object)0) // true

Actually, I can totally understand [1] because probably the .NET runtime will box the integer and start comparing the references instead. But why is [2] different?

7 Answers
Related