The Core of .NET, Fast Focus

VH13 Fast Focus: Safer Code - Nullabilty and Null Operators in C#

08/08/2024

11:30am - 11:50am

Level: Introductory to Intermediate

Jeremy Clark

Developer Educator

JeremyBytes.com

New projects in C# have nullable reference types enabled by default. This helps make the intent of our code more clear, and we can catch potential null references before they happen. But things can get confusing, particularly when migrating existing projects. In this session, you will learn about the safeguards that nullability provides as well as the problems you still need to watch out for yourself. In addition, you will learn the various null operators in C# (including null conditional, null coalescing, and null forgiving operators). These can make your code more expressive and safe.

You will learn:

  • How compile-time warnings help you avoid null reference exceptions
  • How to use nullability to make the intent of your code clear
  • How to use the nullability operators: ?, !, ??