Create Non-Nullable Types in C#

Viewed 36775

How to create non-nullable value types like int, bool, etc. in C#?

3 Answers

7 years later and this is now possible

  • Install .NET Core 3.0 which includes C# 8.
  • Set the language version to 8.0: 8.0 to your .csproj file.
  • Add the property true (.to your csproj)

More details on his this affects writing code and your existing code here:

https://praeclarum.org/2018/12/17/nullable-reference-types.html

Related