Are nullable types only wrappers around a regular value type?

The reason I'm asking is because you can apply a nullable type to a regular type with the Value property. This makes me think that the regular type is simply wrapped in a null type.

+3
source share
3 answers

Yes, this is a general structure:

public struct Nullable<T> where T : struct, new()

This is probably more confusing if you only saw the syntax T?, but it's just syntactic sugar , the compiler changes to Nullable<T>.

Source: http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx , http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx

+7
source

- 'Nullable <T> Structure':

, type - , null .

[, , Reflector ?]

+3

According to MSDN "Nullable types are instances of the System.Nullable<T> struct. A nullable type can represent the correct range of values for its underlying value type, plus an additional null value"

+2
source

All Articles