-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Functional Programming with C#
By :

Handling null in C# has always been quite a challenge. Many software developers (me included) advocate doing a check for NullReferenceException
s as a mandatory task in a code review checklist. In most cases, it is really easy to check for possible null values just by looking at the pull request, even without an IDE. Recently, we received help when Microsoft introduced nullable reference types. So, now, the compiler will join us in the search of possible disasters caused by null.
In the simplest terms, Nullable Reference Types (or NRTs for short) are a feature in C# that allows developers to clearly indicate whether a reference type can be null or not. With this, C# gives us a tool to make our intentions clear right from the start. Think of it as a signpost, guiding other developers (and even our future selves) about what to expect from our code.
Without NRTs, every reference type in C# could...
Change the font size
Change margin width
Change background colour