Nullable References in C# 8.0
Bottom line, C# 8.0 uses the same syntax for nullability of reference types that we have been using for value types:
string x; // not nullable string? y; // nullableAnd yes, that means that the meaning of a type declaration like
string
(without the?
) has changed.Whoa, isn’t that a massive break in compatibility? Actually no. In fact, although this feature looks like a huge breaking change, the entire thing was carefully designed to preserve backward compatibility.
First of all, this whole feature is turned off by default, and has to be explicitly turned on. Second, all it really does is generate warnings.
This seems not that different from nullability in Objective-C, only with cleaner syntax.