O'Reilly logo

C# 4.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

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: ...

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