Nullability and Lifted Operators
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:
int? a = 42;if (a != null) // Really checks for a.HasValue Console.WriteLine("Value = " + a /* or explicitly write a.Value */);int? b = null;if (b == null) Console.WriteLine("Null");
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. ...