If you’re using ViewModels in your ASP.NET MVC applications, know that if working with .NET 4.0, you can now create dynamic view models. And it’s actually very simple to do.
Create an ExpandoObject to represent your ViewModel:
Declare your view to be of type ViewPage<dynamic>
And you’re done. Here’s the output:
If you’re using ReSharper, you will get Intellisense once you’ve declared a property once (both in the Action as well as the View).
12-30-2009 1:29 PM