There is special compiler support for the Nullable
type.
It is impossible to create a user-defined implicit conversion to/from null
. They built it into the language (and the runtime) rather than creating Nullable
on top of the language, as so many BCL classes are made.
Interestingly this is not the only special support created for Nullable
. When you box a Nullable<T>
it doesn't actually box a Nullable
object, ever. If HasValue
is false, null
is boxed, and if it's true, the underlying value is unwrapped and boxed. It would be impossible to do this for your own type.