IKVM.Reflection.Type.IsSubclassOf C# (CSharp) Method

IsSubclassOf() public method

public IsSubclassOf ( Type type ) : bool
type Type
return bool
        public bool IsSubclassOf(Type type)
        {
            Type thisType = this.BaseType;
            while (thisType != null)
            {
                if (thisType.Equals(type))
                {
                    return true;
                }
                thisType = thisType.BaseType;
            }
            return false;
        }

Usage Example

Example #1
0
 string GetTypeKind(Type t)
 {
     if (t.IsEnum)
     {
         return("enum");
     }
     if (t.IsClass)
     {
         if (t.IsSubclassOf(type_multicast_delegate))
         {
             return("delegate");
         }
         else
         {
             return("class");
         }
     }
     if (t.IsInterface)
     {
         return("interface");
     }
     if (t.IsValueType)
     {
         return("struct");
     }
     return("class");
 }
All Usage Examples Of IKVM.Reflection.Type::IsSubclassOf