Relative Content

Tag Archive for c#.netforeachreflectionproperties

Foreach can’t be used for variables of type “PropertyInfo” because “PropertyInfo” has no defintion for “GetEnumerator”

I want to iterate throug a Dictionary<string, object> with a foreach loop. First I get all of the items with reflection. And when item.Name is not settings the program goes in the else path. Here item is of type Dictionary<string, object> during runtime. But I get an error because at compile time item is of type PropertyInfo. Is it possible to loop over the Dictionary?