Search code examples
c#.netresharpervarjetbrains-ide

How to have "var" usage(instead of explicit type) considered as a warning?


By default, Resharper seems to encourage the usage of the var keyword(which I don't really understand, but it's not the point). For our project we deactivated this check, but we would like to have the opposite one: If someone use a var, to have a warning displayed.

Is it possible?


Solution

  • In VS 2015, ReSharper -> Options -> Code Editing -> Code style the following settings make it so that it generates a warning whenever you use var as a type.

    enter image description here