M
M
Given string propertyName, I want to return the value of a property,
like so:
getPropertyValueByFieldName(string propertyName, object myClass){}
Can someone please give me the syntax required for reflecting on a class
this way?
So far I can't get this to work:
object propertyValue =
myClass.GetType().GetProperty(Convert.ToString(propertyName)).GetValue(myClass,null);
like so:
getPropertyValueByFieldName(string propertyName, object myClass){}
Can someone please give me the syntax required for reflecting on a class
this way?
So far I can't get this to work:
object propertyValue =
myClass.GetType().GetProperty(Convert.ToString(propertyName)).GetValue(myClass,null);