liveBook · Manning

Nullable reference types

Nullable reference types are a C# language feature that annotates reference types and enables compile-time analysis of whether they may hold null.

How 3 Manning books explain it

.NET in Action, Second Edition

A nullable reference type is a C# type annotation that allows a reference to represent null and participates in compile-time nullability analysis.

How it is used
Marks properties and method results that may be null so compiler warnings can guide application code.
How deep it goes
Explains annotations, project configuration, warnings, and modeling choices through working examples; stops short of compiler-analysis internals.
Examples
Uses an options property, a book-title constructor, and a nullable comic lookup to expose different reasons for nullability.
What you can do after
Apply it via C# annotations and project settings to address warnings without permitting null where a value is required.

Read how .NET in Action, Second Edition explains nullable reference types →

ASP.NET Core in Action, 3e

Nullable reference types are a C# compiler feature that represents and checks whether reference-type values may be null.

How it is used
Uses nullable annotations to align minimal API handler parameters with missing or null request values.
How deep it goes
Explains annotations, project enablement, binding behavior, and analyzer warnings, but does not descend into compiler implementation.
Examples
Demonstrates Product?, nullable route and query parameters, and a net7.0 project file with Nullable enabled.
What you can do after
Apply nullable annotations and compiler or IDE warnings to configure safer optional parameters in minimal API endpoints.

Read how ASP.NET Core in Action, 3e explains nullable reference types →

Functional Programming in C#, Second Edition

Nullable reference types are a C# feature that uses annotations and compiler analysis to distinguish references that may be null from those that should not be null.

How it is used
Marks intended nullable references and lets the compiler analyze dereferences in enabled contexts.
How deep it goes
Defines nullable annotations and warnings, then notes context dependence, incomplete flow tracking, and runtime gaps.
Examples
Uses Subscriber.Name, a GreetingFor dereference, and JSON containing null for a non-nullable property.
What you can do after
Apply NRT by enabling analysis and annotating optional references, while validating or converting nulls at data boundaries.

Read how Functional Programming in C#, Second Edition explains nullable reference types →

Also covered in

Related concepts

Questions about nullable reference types

What is nullable reference types?

Nullable reference types are a C# language feature that annotates reference types and enables compile-time analysis of whether they may hold null.

Which Manning books explain nullable reference types?

.NET in Action, Second Edition, ASP.NET Core in Action, 3e and Functional Programming in C#, Second Edition.

What is the difference between nullable reference types and option?

Nullable reference types are a C# language feature that annotates reference types and enables compile-time analysis of whether they may hold null. An option type is a type that represents either a value of a specified type or its absence as distinct alternatives.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.