jeudi 19 avril 2018

BindingFlags - get all of them (maximum members)

I tried to get all kind of BindingFlags (in order to get all properties):

BindingFlags ALL_BF =    BindingFlags.CreateInstance | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding |  BindingFlags.FlattenHierarchy |  BindingFlags.GetField |  BindingFlags.GetProperty |  BindingFlags.IgnoreCase |  BindingFlags.IgnoreReturn |  BindingFlags.Instance | BindingFlags.InvokeMethod |  BindingFlags.NonPublic |  BindingFlags.OptionalParamBinding |  BindingFlags.Public |  BindingFlags.PutDispProperty |  BindingFlags.PutRefDispProperty | BindingFlags.SetField |  BindingFlags.SetProperty | BindingFlags.Static | BindingFlags.SuppressChangeType ;

however, this returns empty collection:

obj.GetType().GetProperties( ALL_BF );

when I tried:

obj.GetType().GetProperties( BindingFlags.Public );

that returned many members.

which combination of BFs I should use, in order to get all possible get-able members (public, non-public & whatever exists in object)?





Aucun commentaire:

Enregistrer un commentaire