I have a method which compares two nullable ints and prints the result of the comparison to the console:
I have a very strange situation I don't understand. Below is the case simplified:I don't understand why one expression will net me true and another false. They seem identical.
This is a weird behaviour that I cannot make sense of. In my example I am having a class Sample<T> and in an implicit conversion operator from T to Sample<T>.
Consider the following code:When executed, it writes that Hashcode is 0, but fails with NullReferenceException in attempt to determine type of x. I know that methods called on nullable types are actually called on underlying values, so I expected program to fail during x.GetHashCode().