Coffeehouse Post

Single Post Permalink

View Thread: How much do you use "var" in C#?
  • User profile image
    contextfree

    using var makes your code less tightly coupled at the source level thanks to homoiconicity, in that respect it's similar to other C# features (extension methods, dynamic, auto-Expression-ization of lambdas). 

    for example, maybe you make a bunch of changes to your object model such that the specific types of the intermediate nodes in the Frobnicate -> Tweak -> Confusticate -> * chain change, but the chain is still there, works the same, and the type at the end of the chain stays the same. having used var, this code then won't need to change at all.