Nullability and Lifted Operators

image Introduced in .NET 2.0, nullability allows for the use of struct values in conjunction with a null value. As a short recap, the ? suffix can be appended to a value type name to create the nullable variant of it. This enables you to write code like this:

image

As with most changes that touch the type system of the runtime (and hence languages taking advantage of its features), nullability had quite an impact on the language. In the context of operators, the concept of lifted operators was introduced. The idea is this: ...

Get C# 4.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.