I would like to dynamically add properties to a ExpandoObject at runtime. So for example to add a string property call NewProp I would like to write something like
var x = new ExpandoObject();
x.AddProperty("NewProp", System.String);
Is this easily possible?
Alternatively:
Here is a sample helper class which converts an Object and returns an Expando with all public properties of the given object.
Usage:
As explained here by Filip - http://www.filipekberg.se/2011/10/02/adding-properties-and-methods-to-an-expandoobject-dynamicly/
You can add method too at runtime.