Listing methods using reflection in c#

Hi,
I am using reflection to get all methods defined in an interface.My interface is having a set of methods and properties.By using GetMethods function, it returns all methods in the interface including get and set of each property as functions.Is there a way to get only the functions wriiten by me in the interface
Thanks in advance.
Eby

What i have done is shown here

Assembly a = Assembly.LoadFrom(dllname);
Type[] type = a.GetExportedTypes();
MethodInfo[] mi = t.GetMethods(BindingFlags.Instance | BindingFlags.Public);
foreach (MethodInfo m in mi)
{
Methods.Items.Add(m.ToString());
}
PropertyInfo[] pi = t.GetProperties();
foreach (PropertyInfo p in pi)
{
Properties.Items.Add(p.ToString());
}





Answer this question

Listing methods using reflection in c#

  • Delmer Johnson

    It works....Thank you

  • Ori'

    Try filtering them out with MethodInfo.IsSpecialName, set to True for property accessor and operator overloads.


  • Listing methods using reflection in c#