I'm looking for a way to pass an argument, the value of which - the dictionary built from the object: MyMethod(new { param1="public", param2=123 }).
Using RouteValueDictionary, we can easily convert an object to an IDictionary. But RouteValueDictionary requires a TypeDescriptor that is not available in PCL.
Is there any other way to do this?
==== EDIT ====
Found working code for profile 104:
void MyMethod(object oParams)
{
var dic = from property in oParams.GetType().GetProperties()
select new KeyValuePair<string,object>(property.Name, property.GetValue(oParams,null));
...
}
source
share