Thursday, 6 December 2018

C# 8.0 and Project-wide nullable reference types

C# 8.0 is available for use in Visual Studio 2019 Preview.  Mads Torgersen explains some of the key features in this video.

He explains how to enforce usage in a single file using

#nullable enable

What Mads doesn't explain is how to fully accept the new Nullable Reference Types for your entire project.

The secret is to add this to your .csproj file:

<NullableReferenceTypes>true</NullableReferenceTypes>

It goes here:


Now your whole project enforces nullable reference types!

Credit to this Reddit comment.

1 comment:

  1. Damn so cool just yesterday found this site and today I know what's what
    good best online casino sites Now plans to sit here all your free time and fun and productive

    ReplyDelete