Search code examples
c#dynamic.net-4.0asp.net-4.0viewbag

Creating a class like ASP.NET MVC 3 ViewBag?


I have a situation where I would like to do something simular to what was done with the ASP.NET MVC 3 ViewBag object where properties are created at runtime? Or is it at compile time?

Anyway I was wondering how to go about creating an object with this behaviour?


Solution

  • Use an object of type dynamic. See this article for more information.