C# nullable reference types: null safety step by step

11 steps · about 4 h 15 min · Intermediate

  1. 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.

  2. 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.

  3. 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.

  4. 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 !.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. "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.