Knowledge Base/ReSharper FAQ/Usage, Features and Known Issues/Bugs

Why ReSharper always suggests to "use var" instead of explicit type usages?

Alex Berezoutsky
posted this on May 23, 2013, 12:29

You may read about it ReSharper Code Inspection Wiki; This suggestion is turned on by default.

You can disable this suggestion through "ReSharper | Options | Code Inspection | Inspection Severity":




User photo
Steven Langberg

this helps.


June 11, 2013, 03:44
User photo

As a corollary, I'd really like to enable using the "var" keyword for extracted variables by default. Resharper used to do this before my machine was reloaded -- now I can't seem to find the setting (or help on the net) to re-enable it. To be clear: this isn't to do with the warning insomuch as that, when I press ctrl-r, v, I want to get code like "var someVariableName = <extracted result>"



July 11, 2013, 11:50
User photo
Alex Berezoutsky

@Davyd, by default, ReSharper is asking if you'd like to use var or explicit type when introducing variable (see screenshot). You need to have ReSharper IntelliSense enabled for it in the options, though (ReSharper | Options | IntelliSense | General).

July 11, 2013, 13:47
User photo

Thanks, I see that Resharper is remembering my last choice -- I just don't remember it even asking in the past (and, personally, I'd prefer it not to). I could be well wrong about whether or not it was asking -- but I still maintain that I'd prefer it not to ask at all as I'd always like to use var and it's just one extra confirmation I have to go through (:

July 11, 2013, 15:47
User photo

This entry simply does not exist in ReShaper 9. How can I disable this annoying shit?

March 5, 2015, 20:16
User photo

Looks like they expanded it out into further options

June 8, 2015, 13:26