private static int GetTypeDepth(Type type) { if (type.IsByRef) { return GetTypeDepth(type.GetElementType()); } else if (type.IsInterface) { return GetInterfaceDepth(type); } return GetClassDepth(type); }