Passing anonymous objects to MVC views and accessing them using dynamic

December 19th, 200912:06 am @ Editor

0


First, I’ll start with a little disclaimer: this post is not about whether using dynamic is better/worse than static typing. Instead, it’s about making it more convenient to use dynamic if you choose to go that route . Clearly, some people dislike dynamic, as you can see in the comments in that post from Phil Haack , and for the most part, all the key arguments for/against have been made. So anyway, let’s proceed… Recently, a few people have experimented with extending their view pages from ViewPage<dynamic>. The idea is to then be able to access model data using the more convenient dynamic syntax. e.g. check out this thread on StackOverflow, as well as Phil’s post I mention above. One limitation that people are hitting is that you can…(read more)