Resharper and var

Posted by Refracted Paladin on Stack Overflow See other posts from Stack Overflow or by Refracted Paladin
Published on 2009-04-10T14:43:41Z Indexed on 2010/06/09 16:12 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

I have Resharper 4.5 and have found it invaluable so far but I have a concern; It seems to want to make every variable declaration implicit(var). As a relativly new developer how much should I trust ReSharper when it comes to this? Take the below code snippet from a method that Paints Tab Headers.

            TabPage currentTab = tabCaseNotes.TabPages[e.Index];
        Rectangle itemRect = tabCaseNotes.GetTabRect(e.Index);
        SolidBrush fillBrush = new SolidBrush(Color.Linen);
        SolidBrush textBrush = new SolidBrush(Color.Black);
        StringFormat sf = new StringFormat
                              {
                                  Alignment = StringAlignment.Center,
                                  LineAlignment = StringAlignment.Center
                              };

Resharper wants me to change all 5 of those to var. I have read the following similar post,Use of var keyword in C#, but I would like to know from a Resharper standpoint.

Thanks!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about subjective