I know why this is not allowed:
ulong x = 0xFEDCBA9876543210;
long y = Int64.MaxValue;
Console.WriteLine(x < y);
Obviously, there is no way for the runtime to implicitly cast either operand to the other type or a larger type to make the comparison work.
Operator '<' cannot be applied to operands of type 'ulong' and 'long'.
So, this is also not allowed (with MinValue and const):
ulong x = 0xFEDCBA9876543210;
const long y = Int64.MinValue;
Console.WriteLine(x < y);
Yet, this is allowed (with MaxValue instead):
ulong x = 0xFEDCBA9876543210;
const long y = Int64.MaxValue;
Console.WriteLine(x < y);
There is no overload of < accepting a ulong and long, but I saw with Reflector that this will silently convert Int64.MaxValue to a ulong. But this does not always happen. How does it work, and what considerations are the reason for this inconsistency?