Reputation: 21
How make reference type as nullable in c#4.0.
In c#8.0 we can make reference type as nullable. But how to achieve this in c#4.0?
Upvotes: 1
Views: 124
Reputation: 568
Reference types are always nullable in C#
In C#8 they added a feature called "Nullable reference type" to warn you when you don't check for null your variables
However, you can achieve similar null-safety warnings on other versions of C# by using a extension for VisualStudio called ReSharper (it's not free)
Details on how it deals with null-checking you can find here
Upvotes: 7