XmlSchemaType.IsDerivedFrom Method (XmlSchemaType, XmlSchemaType, XmlSchemaDerivationMethod)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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


Type: System.Xml.Schema.XmlSchemaType

The derived XmlSchemaType to test.

Type: System.Xml.Schema.XmlSchemaType

The base XmlSchemaType to test the derived XmlSchemaType against.

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