jeudi 28 septembre 2017

Reflection - How to get attribute of property?

How can i get some parameters (or attributes, if they are called so), with reflection?

MyObject x = new MyObject(...);
..........
var propInfo = x.GetType().GetProperty("something");
if (propInfo != null) {
    xyz= propInfo.GetValue(x,null).Metrics.Width //<------ gives error
}





Aucun commentaire:

Enregistrer un commentaire