IsDerivedFrom() public method

public IsDerivedFrom ( XmlSchemaDatatype datatype ) : bool
datatype XmlSchemaDatatype
return bool
Beispiel #1
0
 internal static bool IsDerivedFromDatatype(XmlSchemaDatatype derivedDataType, XmlSchemaDatatype baseDataType, XmlSchemaDerivationMethod except)
 {
     if (DatatypeImplementation.AnySimpleType.Datatype == baseDataType)
     {
         return(true);
     }
     return(derivedDataType.IsDerivedFrom(baseDataType));
 }
        internal override bool IsComparable(XmlSchemaDatatype dtype)
        {
            XmlTypeCode typeCode = this.TypeCode;
            XmlTypeCode code2    = dtype.TypeCode;

            if (typeCode != code2)
            {
                if (GetPrimitiveTypeCode(typeCode) == GetPrimitiveTypeCode(code2))
                {
                    return(true);
                }
                if (!this.IsDerivedFrom(dtype) && !dtype.IsDerivedFrom(this))
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #3
0
        private static bool IsDerivedFromDatatype(object derivedType, object baseType, XmlSchemaDerivationMethod except)
        {
            if (XmlSchemaDatatype.AnyType == baseType)
            {
                return(true);
            }
            XmlSchemaDatatype dtDerived = derivedType as XmlSchemaDatatype;

            if (dtDerived == null)
            {
                return(false);
            }
            XmlSchemaDatatype dtBase = baseType as XmlSchemaDatatype;

            if (dtBase == null)
            {
                return(false);
            }
            return(dtDerived.IsDerivedFrom(dtBase));
        }
        internal override bool IsComparable(XmlSchemaDatatype dtype) {
            XmlTypeCode thisCode = this.TypeCode;
            XmlTypeCode otherCode = dtype.TypeCode;

            if (thisCode == otherCode) { //They are both same built-in type or one is list and the other is list's itemType
                return true;
            }
            if (GetPrimitiveTypeCode(thisCode) == GetPrimitiveTypeCode(otherCode)) {
                return true;
            }
            if (this.IsDerivedFrom(dtype) || dtype.IsDerivedFrom(this)) { //One is union and the other is a member of the union
                return true;
            }
            return false;
        }
Beispiel #5
0
 internal static bool IsDerivedFromDatatype(XmlSchemaDatatype derivedDataType, XmlSchemaDatatype baseDataType, XmlSchemaDerivationMethod except) {
     if (DatatypeImplementation.AnySimpleType.Datatype == baseDataType) {
         return true;
     }
     return derivedDataType.IsDerivedFrom(baseDataType);
 }
 internal override bool IsComparable(XmlSchemaDatatype dtype)
 {
     XmlTypeCode typeCode = this.TypeCode;
     XmlTypeCode code2 = dtype.TypeCode;
     if (typeCode != code2)
     {
         if (GetPrimitiveTypeCode(typeCode) == GetPrimitiveTypeCode(code2))
         {
             return true;
         }
         if (!this.IsDerivedFrom(dtype) && !dtype.IsDerivedFrom(this))
         {
             return false;
         }
     }
     return true;
 }