Generally, I'm on the side of using var's everywhere.
I unfortunately spent an entire day looking at diffs last week. To make matters worse, they were delta's of a code drop from an outside vendor where the code were weeks apart from one drop to the next. It was littered with var's. It shouldn't have been a problem except there was a massive refactoring effort that had changed the types of various objects and methods. Having a diff tool or code review tool that supported the Visual Studio feature of tooltips that expanded out to show the types would have been very very useful. (I ended up having two VS sessions open along with the diff tool to do my code review.)
After that experience, the pendulum swung again for me toward's only using var when the type will be obvious.
45 Replies - 27244 Views - Last Post: 20 April 2015 - 06:43 AM