Beispiel #1
0
 // Determine if this type is a subclass of "c".
 public override bool IsSubclassOf(Type c)
 {
     if (c == null)
     {
         // Can never be a subclass of "null".
         return(false);
     }
     else if (type != null)
     {
         // We have been created, so use the underlying type.
         if (c is TypeBuilder)
         {
             Type otherType = ((TypeBuilder)c).type;
             if (otherType != null)
             {
                 return(type.IsSubclassOf(otherType));
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(type.IsSubclassOf(c));
         }
     }
     else
     {
         // This type isn't created yet, so scan up the
         // tree looking for the specified type.
         if (this == c || parent == c)
         {
             return(true);
         }
         else if (parent != null)
         {
             return(parent.IsSubclassOf(c));
         }
         else
         {
             return(false);
         }
     }
 }