As to your question,
Why is that? why should I buy resharper's suggestion when I think that it is not a good idea?
Here is my opinion from my experience. Some pro's of accepting this particular suggestion:
- It aids in refactoring because StatusResult only occurs once
- It shortens the line and removes a redundant declaration that is easily inferred by someone reading the code
- It is less typing and the line is written faster when coding
Now, if the line of code was:
var result = GetStatusResult(); // A method call
I personally would not use var because a maintainer now needs to grok GetStatusResult() to see what var is.
At the end of the day it is a personal decision, unless you have to follow a coding standard, in which case you should lobby to change the standard or just go along with it.
As a side note, and as Benesh mentions below, var != dynamic. I think this is where var get's a bad rap. Plus the overuse in the example of when not to use it I provided above.