Ask ReSharper to not to suggest to use var instead of a type name.
Posted by Vadim on November 20, 2008
If you read my blog, you know I’m using ReSharper (R#). Each time I install R#, I need to change the default settings.
By default R# will suggest to use ‘var’ keyword when initializer explicitly declares type.
You can see the green wavy line bellow the type. R# wants to replace the type with var keyword. There’s nothing wrong to use new cool keyword but I personally prefer the type instead the var keyword.
R# by default also will hint to replace the type with var for implicit declaration. If a suggestion is green wavy line, a hint is straight line that is two characters long.
So incase if you are also have a strong or may be mild desire to loose these suggestion and hint, follow this instruction:
- In Visual Studio select ReSharper/Optoins… or press Alt-R + O. It should open ReSharper – Options window.
- Click on Inspection Severity in Code Inspection section.
- On the right part of the dialog scroll down until you see Use ‘var’ keyword when initializer explicitly declares type.
- Click on arrow down button, and change from Show as suggestion to Do not show.
- On the next line bellow for Use ‘var’ keyword when possible change from Show as hint to Do not show.