Type IDValuewill be object- because he PropertyInfodoes not know anything better. Therefore you call object.Equals(object)for IDValue.Equals(0). In this box, the value of Int32 is 0 ... and overriding Equals(object)in Int64checks that it is valid Int64with which you are comparing it. This is not the case in this case, so it returns false.
, Equals(0L), true.
, IDValue Int64, true, Int64.Equals(Int64), Int32 Int64:
using System;
class Test
{
static void Main()
{
Int64 i64 = 0L;
Console.WriteLine(i64.Equals(0));
object boxed = i64;
Console.WriteLine(boxed.Equals(0));
Console.WriteLine(boxed.Equals(0L));
}
}