nullable reference types

A C# compiler feature that tracks whether each reference might be null and warns when code uses one without checking.

In more detail

Switch it on with <Nullable>enable</Nullable>; every template since .NET 6 does. With it on, string means a value that is there and string? means one that may be missing. The warnings do not stop the build unless warnings are treated as errors.

Example

<Nullable>enable</Nullable>

Related terms

Taught in

References