To 'var' or not to 'var'?

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4

45 Replies - 27447 Views - Last Post: 20 April 2015 - 06:43 AM

#46 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 4183
  • View blog
  • Posts: 13,338
  • Joined: 05-May 12

Re: To 'var' or not to 'var'?

Posted 20 April 2015 - 06:43 AM

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.
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4