'C#8 Nullable types (?) vs Resharper nullability annotations

I'm working on an ABP project and noticed that Resharper auto-formats a nullable type like string? to [CanBeNull] string

Is there still any benefit to using Resharper Annotations over C#8 features?



Solution 1:[1]

The attributes [CanBeNull] etc. where Resharpers way of implementing nullability annotations. This may be my opinion, but going forward, I believe these are obsolete. If you use C#8 nullable types, these attributes are confusing and conflicting, too. Just delete the Resharper Annotations.cs file from your project and change the code to use the new ? syntax.

Additionally, you might want to enable the Resharper configuration option "Use nullable annotation instead of an attribute". I'm not sure whether there are more similar options, but I have never seen an automatic replacement as you describe it above.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PMF