I'm trying to get the value from a PropertyInfo[]
, but I can't get it to work:
foreach (var propertyInfo in foo.GetType().GetProperties())
{
var value = propertyInfo.GetValue(this, null);
}
Exception:
Object does not match target type.
Isn't this how it's supposed to be done?
See Question&Answers more detail:os