Here you call two different methods - Double.Equals(double)and Object.Equals(object). For the first call, it is intimplicitly converted to double, so the input to the method is equal double, and it performs an equality check between the two doubles. However, for the second call intit is not transferred to double, it is only inserted into the box. If you look at the method Double.Equals(object)in the reflector, the first line:
if (!(obj is double))
{
return false;
}
therefore, it returns false, since the input is a box int, not a box double.
Good booty!
source
share