Hi I am having a slight problem with dynamically listing the methods of a selected class. The code I have written is:
private void ListMethods(ClassA aClass, ComboBox cmbMethods)
{
Type type = typeof(Application35.ClassA);
foreach(MethodInfo aMethod in type.GetMethods())
{
cmbMethods.Items.Add(aMethod.ToString());
}
cmbMethod.Visible = true;
}
There are a number of overloads for this method, each dealing with a different class.
The method functions, however the list box is populated with more than just the method name, it includes the return type as well, also all of the methods inherited by the class are listed.
Does anyone know how to list just the name of the method and only methods that are defined within the class and not within parent classes please?