ReSharper and var [duplicate]

Resharper is primarily concerned with helping you refactor code, and the var keyword generally makes refactoring easier. For example, if the return values of any of those functions ever change to a compatibile type, you don’t have to change any of this code. It’s therefore now a little easier to refactor your tabCaseNotes type, for example.

Personally, I’m often inclined to leave your first two lines alone, because I like to see the type name for a variable explicitly listed somewhere on the line where the variable is declared. If anything, I might look for an interface to use instead, so that I also gain the same “generic-ness” as with the var keyword without losing any important readable type information. However, I would definitely use var for fillBrush, textBrush, and sf.

Leave a Comment