How do I reflect over the members of dynamic object?
Posted
by Flatliner DOA
on Stack Overflow
See other posts from Stack Overflow
or by Flatliner DOA
Published on 2010-04-14T04:20:20Z
Indexed on
2010/04/14
4:23 UTC
Read the original article
Hit count: 247
I need to get a dictionary of properties and their values from an object declared with the dynamic keyword in .NET 4? It seems using reflection for this will not work.
Example:
dynamic s = new ExpandoObject();
s.Path = "/Home";
s.Name = "Home";
// How do I enumerate the Path and Name properties and get their values?
IDictionary<string, object> propertyValues = ???
© Stack Overflow or respective owner