2

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.

dthorpe
  • 35,318
  • 5
  • 75
  • 119
Eric Yin
  • 8,737
  • 19
  • 77
  • 118
  • What do you want to do with your dynamic object? Cant you just use the dynamic type? http://msdn.microsoft.com/en-us/library/dd264741.aspx – Rohan West Dec 09 '11 at 01:28
  • I have to write extra code for me to use the dynamic object, I found answer below, which I can just use it directly. – Eric Yin Dec 09 '11 at 01:49

1 Answers1

6

Have a look at the ExpandoObject Class.

ExpandoObject Class

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

dtb
  • 213,145
  • 36
  • 401
  • 431