Introduction

 
C# 8 introduced a new feature in the language called Nullable Reference Types.  
 
Even if you specify C# 8 as your language version in Visual Studio, the Nullable Reference Types feature in C# 8 is disabled by default.
 

How to enable the feature

 
You can enable the feature by setting the Nullable property to enable inside your C# project file.
 
Enabling this feature drastically changes the semantics of your code.
 
The compiler will start working with a different set of rules.
 
Any variable of a reference type will be considered non-nullable and can be dereferenced safely. The compiler will show a warning all the time you attempt to assign null to a reference type variable.
 
Learn how you can enable this feature and start fixing nullability issues in your code base. 
 

Conclusion

 
The new set of warnings the compiler can generate when you enable the Nullable Reference Types feature, can be a massive help for the developers and will help to spot bugs and write code of better quality. This feature is definitely a game changer for C# developers and I invite you to use it especially on new projects.
 

How to enable Nullable Reference Types
Jul 29 2020

Andrea Angella

Learn how you can enable the Nullable Reference Types feature in C# 8 and start fixing nullability issues in your code base.