XmlSchemaType.IsDerivedFrom Method (XmlSchemaType, XmlSchemaType, XmlSchemaDerivationMethod)

 

Returns a value indicating if the derived schema type specified is derived from the base schema type specified

Namespace:   System.Xml.Schema
Assembly:  System.Xml (in System.Xml.dll)

public static bool IsDerivedFrom(
	XmlSchemaType derivedType,
	XmlSchemaType baseType,
	XmlSchemaDerivationMethod except
)

Parameters

derivedType
Type: System.Xml.Schema.XmlSchemaType

The derived XmlSchemaType to test.

baseType
Type: System.Xml.Schema.XmlSchemaType

The base XmlSchemaType to test the derived XmlSchemaType against.

except
Type: System.Xml.Schema.XmlSchemaDerivationMethod

One of the XmlSchemaDerivationMethod values representing a type derivation method to exclude from testing.

Return Value

Type: System.Boolean

true if the derived type is derived from the base type; otherwise, false.

The following is an example of the IsDerivedFrom method.

XmlSchemaType xsdInteger = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Integer);
XmlSchemaType xsdPositiveInteger = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.PositiveInteger);

// true
Console.WriteLine(XmlSchemaType.IsDerivedFrom(xsdPositiveInteger, xsdInteger, XmlSchemaDerivationMethod.None));

// false
Console.WriteLine(XmlSchemaType.IsDerivedFrom(xsdPositiveInteger, xsdInteger, XmlSchemaDerivationMethod.Restriction));

.NET Framework
Available since 2.0
Return to top
Show: