O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Type Background

From a type perspective, you can draw the parallel to array types and generic types as type constructors. Given a type, another type can be constructed thanks to out-of-the-box runtime and language facilities. For nullable value types, that’s the case, too, but with some restrictions. As the name implies, they’re only supported over value types, but it’s also impossible to “nest” them, as in int?? or Nullable<Nullable<int>>.

The top part of Figure 4.40 shows the principle of a type constructor. Given any type T, as indicated by the dotted-lined box, a more complex type can be created. In this example, it’s a Nullable<T> type that provides a box around the original type with the HasValue and Value properties on it. At the bottom, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required