mercredi 9 mai 2018

How it's possible to get property while it is not shown?

I use this code:

BindingFlags flags= BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;

PropertyInfo prop =  myObj.GetProperty("Age", flags);

prop is not null. However, when I try to get all properties from myObj:

foreach(MemberInfo e in obj.GetType().GetMembers( flags) ) {    //neither GetProperties helps
    Console.WriteLine(e.Name);
}

that property (Age) is not listed. I can't understand how this happens.





Aucun commentaire:

Enregistrer un commentaire