I'm retrieving an IEnumerable list of properties via following code:
BindingFlags bindingFlag = BindingFlags.Instance | BindingFlags.Public;
var dataProperties = typeof(myParentObject).GetProperties(bindingFlag);
Then I'm iterating through the list and retrieving the value for each property.
I've come across two different approaches to doing this, and just wondered what the difference is between them:
1)
object propertyValue = property.GetGetMethod().Invoke(myObject, null);
2)
object propertValue = property.GetValue(myObject, null)