Use Reflection to Get a List of Interfaces that a Class Implements

You can query an object at runtime, using reflection, to get information about its members.  This includes the interfaces that the object’s class implements.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Cow bessie = new Cow("Bessie", 4);
 
// Use reflection to dump out information about
//   Bessie's interfaces and the methods in
//   each interface.
Type t = bessie.GetType();
foreach (Type iType in t.GetInterfaces())
{
    Console.WriteLine("Interface [{0}]:", iType.Name);
    foreach (MemberInfo minfo in iType.GetMembers())
    {
        Console.WriteLine("  {0}", minfo.Name);
    }
}