I know viewbag is one of the ready-to-use DynamicObject, but if you are not in a view or controller, is there any other Ready-to-use DynamicObject except to write your own?

(btw, I found a sample of a great implement http://www.codeproject.com/KB/cs/dynamicincsharp.aspx )

I am really lazy and just want to use some already made DynamicObject.

有帮助吗?

解决方案

Have a look at the ExpandoObject Class.

ExpandoObject Class

Represents an object whose members can be dynamically added and removed at run time.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top