Home > Back-end >  Programmatically get a list of method names in a form
Programmatically get a list of method names in a form

Time:09-20

I would like to be able to get a list of names of all the methods in a form (similar to the list obtained by pressing Alt M).

CodePudding user response:

I found the way to get only the names of the methods created by me.

Type methodInfoType = (typeof(Form_CreateNodes));
// Get the public methods.
MethodInfo[] arrayOfPublicMethodsNames = methodInfoType.GetMethods(
    BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

// Get the nonpublic methods.
MethodInfo[] arrayOfNonpublicMethodsNames = methodInfoType.GetMethods(
    BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  • Related