How to dynamically get a property by name from a C# ExpandoObject?
ExpandoObject
provides access both via dynamic
and via IDictionary<string,object>
- so you could just use the dictionary API:
var byName = (IDictionary<string,object>)account.features;bool val = (bool)byName["isEmailEnabled"];
Or if the name is fixed, just:
bool val = ((dynamic)account).features.isEmailEnabled;