static int GetInterfaceDepth(Type type)
{
Type[] interfaces = type.GetInterfaces();
if (interfaces.Length > 0)
{
int current = 0;
foreach (Type i in interfaces)
{
int depth = GetInterfaceDepth(i);
if (depth > current)
{
current = depth;
}
}
return 1+current;
}
return 1;
}