lundi 31 août 2015

How to get custom a list of methods C# with reflection

I have being using reflection to create a list of methods that the user would use in a dynamic generated menu (I'am in unity). I'am using:

MethodInfo[] methodInfos =  myObject.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

But not all public methods of the class should appear in this menu, so I was wondering, is there some flag which I could use to mark only the methods that I need?

And then use this "custom flag" to get those methods through reflection. Thanks :).





Aucun commentaire:

Enregistrer un commentaire