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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.