Why does the == operator work for Nullable<T> when == is not defined?
问题 I was just looking at this answer, which contains the code for Nullable<T> from .NET Reflector, and I noticed two things: An explicit conversion is required when going from Nullable<T> to T . The == operator is not defined. Given these two facts, it surprises me that this compiles: int? value = 10; Assert.IsTrue(value == 10); With the code value == 10 , either value is being magically converted to an int (hence allowing int 's == operator to be used, or the == operator is being magically