I looked at DateTime Equals implementation :
public bool Equals(DateTime value)
{
return (this.InternalTicks == value.InternalTicks);
}
and then look at internalticks
internal long InternalTicks
{
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
get
{
return (((long) this.dateData) & 0x3fffffffffffffffL);
}
}
And then I noticed this number : 0x3fffffffffffffffL
which is : 4611686018427387903
But more interesting is its binary representation :
00111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
^^
||
Please notice the arrows
I could have understand if only the left arrow would have been 0 ( positive representation)
-
But why the second one is also
0? -
Also , why would i every want it to be
&with a1111....number ? if I want to display5I don’t have to do5 & 1, just 5.
Any help?
You can get this kind of information from the Reference Source. The most relevant declarations in dd/ndp/clr/src/bcl/system/datetime.cs:
Note how the Kind values map to those two bits.