Why does the default view for a List in ASP.NET MVC use 'var' to iterate through the items?

Posted by SLC on Stack Overflow See other posts from Stack Overflow or by SLC
Published on 2010-03-25T14:30:26Z Indexed on 2010/03/25 14:33 UTC
Read the original article Hit count: 153

Filed under:

The title pretty much sums it up, it puts the following line of code in:

 <% foreach (var item in Model) { %>

As the View is auto-generated and uses reflection to work out exactly what item is, so you get intellisense and everything, I just wonder, why do they use var rather than the actual type?

© Stack Overflow or respective owner

Related posts about asp.net-mvc