C# nullable reference types: null safety step by step
11 steps · about 4 h 15 min · Intermediate
- Null safety in C# - C# (guide, Microsoft Learn, 10 min)
It gives the big picture first: what null safety is, how value types and reference types differ, and which operators help.
- Embracing nullable reference types - .NET Blog (blog, Microsoft .NET Blog, 10 min)
A short example shows the warning, the string? fix, and the null check that clears it.
- Nullable reference types - C# (doc, Microsoft Learn, 15 min)
It explains null-state, maybe-null versus not-null, and that this is purely a compile-time feature.
- Nullable Reference Types and Null Operators in C# (video, Jeremy Clark (Jeremy Bytes), YouTube, 30 min)
It walks through code that crashes, enables the feature, and fixes each warning with ?., ?? and !.
- C# Nullable Refernce Types: Everything You Need To Know (video, YouTube, 20 min)
This is a recent modern-.NET recap that reinforces the basics before you go to the reference docs.
- Tutorial: Express your design intent with nullable and non-nullable reference types - C# (tutorial, Microsoft Learn, 40 min)
You build a small survey library to practise modelling required and optional data.
- Nullable reference types - C# reference (reference, Microsoft Learn, 20 min)
It covers the nullable contexts and the limits of T?, which you need once the tutorial's basics work.
- Nullable reference type warnings - C# reference (reference, Microsoft Learn, 20 min)
This is the lookup page for the CS86xx warnings you'll meet, so you can decode each one.
- Attributes interpreted by the compiler: Nullable static analysis - C# reference (reference, Microsoft Learn, 25 min)
Attributes such as NotNull, MaybeNull and NotNullWhen let you describe null behaviour the type system can't express.
- Nullable migration strategies - C# (guide, Microsoft Learn, 20 min)
It shows how to roll the feature out across an existing codebase in phases, once you know the rules.
- "C# Nullable Reference Types Explained" By Matthew Hess (video, Matthew Hess, YouTube, 45 min)
It covers the confusion and debate around the feature, so you learn its limits and trade-offs.