Nullable reference types — advanced guide
summary
C# 8 adds nullable reference types as compile‑time annotations only, no runtime checks, and the compiler team spends about 15 person‑years building it. Migrating big projects is incremental: use project/file flags, warnings‑only mode, or opt out per region; Newtonsoft.Json required 170 files, 4000 lines changed as a real example. New features include generic constraints (class?, notnull), the postfix ! “dammit” operator, and System.Diagnostics.CodeAnalysis attributes (NotNullWhen, DoesNotReturn/MemberNotNull, etc.) to teach the analyzer; beware limitations in arrays, generics, dataflow, closures and that defaults remain null.
AI-written summary · about
chapters (6)
- 0:00Introduction to nullable reference types
- 5:05How nullable reference types work
- 13:12Working with generics and constraints
- 29:44Handling compiler warnings and errors
- 43:08Common pitfalls and limitations
- 54:53Conclusion and recommendations








