Incorrect suggestion "Rewrite as DateTime?" in using statement

C

  1. 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?

0
3 comments
Avatar
Permanently deleted user

Out of pure curiosity, why the preference of "NullableDateTime" over "DateTime?" ?

0
Avatar
Permanently deleted user

.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 ;)

0
Avatar
Permanently deleted user

Ahh, I see.

0

Please sign in to leave a comment.