This question already has an answer here:
I am building a dynamic method, which takes in an object name (string)
public Message Message => model;
What I need to do is get a particular property on Message using the name of the property like so:
Type myType = typeof("Message");
Then get the value of the property like this:
myType .GetProperty("Message").GetValue(myType, null);
"Message" will any string input which points to a property on the Message objecy
Is this possible using reflection?
Aucun commentaire:
Enregistrer un commentaire