System.DefaultBinder.GetHierarchyDepth C# (CSharp) Method

GetHierarchyDepth() static private method

static private GetHierarchyDepth ( Type t ) : int
t Type
return int
        internal static int GetHierarchyDepth(Type t)
        {
            int depth = 0;

            Type currentType = t;
            do 
            {
                depth++;
                currentType = currentType.BaseType;
            } while (currentType != null);

            return depth;
        }

Usage Example

        // Token: 0x06000D9C RID: 3484 RVA: 0x00029C68 File Offset: 0x00027E68
        private static int FindMostSpecificMethod(MethodBase m1, int[] paramOrder1, Type paramArrayType1, MethodBase m2, int[] paramOrder2, Type paramArrayType2, Type[] types, object[] args)
        {
            int num = DefaultBinder.FindMostSpecific(m1.GetParametersNoCopy(), paramOrder1, paramArrayType1, m2.GetParametersNoCopy(), paramOrder2, paramArrayType2, types, args);

            if (num != 0)
            {
                return(num);
            }
            if (!DefaultBinder.CompareMethodSigAndName(m1, m2))
            {
                return(0);
            }
            int hierarchyDepth  = DefaultBinder.GetHierarchyDepth(m1.DeclaringType);
            int hierarchyDepth2 = DefaultBinder.GetHierarchyDepth(m2.DeclaringType);

            if (hierarchyDepth == hierarchyDepth2)
            {
                return(0);
            }
            if (hierarchyDepth < hierarchyDepth2)
            {
                return(2);
            }
            return(1);
        }
All Usage Examples Of System.DefaultBinder::GetHierarchyDepth