Vadim's Weblog

Never stop learning.

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.

R#_use_var

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.

R#_use_var_implicit

So incase if you are also have a strong or may be mild desire to loose these suggestion and hint, follow this instruction:

  1. In Visual Studio select ReSharper/Optoins… or press Alt-R + O. It should open ReSharper – Options window.
  2. Click on Inspection Severity in Code Inspection section.
  3. On the right part of the dialog scroll down until you see Use ‘var’ keyword when initializer explicitly declares type.
  4. Click on arrow down button, and change from Show as suggestion to Do not show.
  5. On the next line bellow for Use ‘var’ keyword when possible change from Show as hint to Do not show.

R#_option_var

kick it on DotNetKicks.com

About these ads

6 Responses to “Ask ReSharper to not to suggest to use var instead of a type name.”

  1. dubik said

    What is the font name you are using in vs?

  2. Vadim said

    Dubik,

    The font is Consolas you can download Consolas Font Pack for Microsoft Visual Studio 2005 or 2008.

  3. dubik said

    Awesome, thanks Vadim.

  4. Jay Allard said

    Greetings

    When you get the VAR squiggly, press ALT ENTER. One of the options is to disable that check. You don’t have to go through the menu system for it.

  5. Vadim said

    Jay,

    It’s too obvious for me to figure out. Thanks for the tip.

  6. you have to check this out Windows Live Messenger…

    [...]Ask ReSharper to not to suggest to use var instead of a type name. « Vadim's Weblog[...]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: