I need to call a public property of a class based on the string value of its name, as I won't know until run time what properties are required. I'm trying to use reflections unsuccessfully. The class looks like this:
class FieldCalculation
{
public string MyValue
{
get
{
return "Test Data";
}
}
}
I think access the value of the property should look something like this:
FieldCalculation myClass = new FieldCalculation();
string value = myClass.GetType().GetProperty("MyValue");
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire