Search code examples
c#resharperimplicit-typing

Using implicit typing


Possible Duplicate:
Resharper: vars

Is there a reason that resharper suggests var thing1 = 5 as opposed to int thing1 = 5? It just seems that they mean the exact same thing except that var is harder/less comprehensible to a human reader. I would be curious to know if there is a difference in the way that the compiler interprets them, or if its just syntactic sugar.


Solution

  • No, the generated IL will be exactly the same.

    I suspect if you take up Resharper's suggestion, it will also "suggest" going the other way - IIRC the default is to always offer the ability to change in either direction. You can change what it suggests within the options though.