Incorrect suggestion "Rewrite as DateTime?" in using statement
C
doesn't allow shorthand notation for nullable types in using statements, hence the suggestion is wrong. It occurs with every nullable type.
using NullableDateTime = System.Nullable<System.DateTime>; <--- R# suggests to rewrite as DataTime?
Please sign in to leave a comment.
Out of pure curiosity, why the preference of "NullableDateTime" over "DateTime?" ?
.NET 1.1 didn't have nullable types so we added those ourself. For example NullableDateTime worked as DateTime?.
When we migrated to .NET 2 and up, in order to ease the conversion process we added this using statement to avoid breaking existing code as much as possible (when replacing NullableDateTime with DateTime?).
It is a leftover of course, which will be removed completely in a few years but still the R# makes a wrong suggestion ;)
Ahh, I see.