public override bool IsDerivedFrom(XmlSchemaDatatype datatype)
 {
     if (datatype == null)
     {
         return(false);
     }
     for (DatatypeImplementation implementation = this; implementation != null; implementation = implementation.baseType)
     {
         if (implementation == datatype)
         {
             return(true);
         }
     }
     if (((DatatypeImplementation)datatype).baseType == null)
     {
         Type type = base.GetType();
         Type c    = datatype.GetType();
         if (!(c == type))
         {
             return(type.IsSubclassOf(c));
         }
         return(true);
     }
     if (((datatype.Variety == XmlSchemaDatatypeVariety.Union) && !datatype.HasLexicalFacets) && (!datatype.HasValueFacets && (this.variety != XmlSchemaDatatypeVariety.Union)))
     {
         return(((Datatype_union)datatype).IsUnionBaseOf(this));
     }
     return((((this.variety == XmlSchemaDatatypeVariety.Union) || (this.variety == XmlSchemaDatatypeVariety.List)) && (this.restriction == null)) && (datatype == anySimpleType.Datatype));
 }