private static int GetDepth(Type type) { int depth = 0; if (type.BaseType != null) { depth = 1 + GetDepth(type.BaseType); } return depth; }