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);