Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# convert dictionary to anonymous object

var dict = new Dictionary<string, object> { { "Property", "foo" } };
dynamic eo = dict.Aggregate(new ExpandoObject() as IDictionary<string, Object>,
                            (a, p) => { a.Add(p.Key, p.Value); return a; });
string value = eo.Property;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #dictionary #anonymous #object
ADD COMMENT
Topic
Name
5+2 =