dimanche 8 mars 2015

Custom Type instance from IDynamicMetaObjectProvider

Is there a .NET method or library that allows obtaining an instance of type inheriting System.Type that contains information about a particular IDynamicMetaObjectProvider or DynamicMetaObject methods and properties, utilizing information returned for example from GetDynamicMemberNames?

Example:



dynamic d = new ExpandoObject();
d.Prop1 = 8;
d.Prop2 = null;
Type t = GetTypeForDynamicObject(d);
foreach(PropertyInfo pi in t.GetProperties())
{
Console.WriteLine(pi.Name);
}


Should output:



Prop1
Prop2




Aucun commentaire:

Enregistrer un commentaire