c# 8 nullable types - replace var keyword with explicit type properly



Is there a way to set the behavior of the context action 'replace var with explicit type' so that when the type is not null, it does not add the nullability mark?

As below, the string is surely NOT null, so it should be possible to NOT add the ?.

I am aware that I can assign it null in the future, but it should not be the default, but rather explicit.


Kind regards,


1 comment
Comment actions Permalink

Hello Bartosz Jarmuż, thank you for your feedback. There is the following YouTrack ticket about this problem: https://youtrack.jetbrains.com/issue/RSRP-480821

You're welcome to comment or vote for it to get the notifications about status changes. Have a great day! :)


Please sign in to leave a comment.