共用方式為


XmlSchemaType.IsDerivedFrom 方法

定義

傳回值,指出所指定衍生結構描述類型是否衍生自指定的基底結構描述類型。

public:
 static bool IsDerivedFrom(System::Xml::Schema::XmlSchemaType ^ derivedType, System::Xml::Schema::XmlSchemaType ^ baseType, System::Xml::Schema::XmlSchemaDerivationMethod except);
public static bool IsDerivedFrom (System.Xml.Schema.XmlSchemaType? derivedType, System.Xml.Schema.XmlSchemaType? baseType, System.Xml.Schema.XmlSchemaDerivationMethod except);
public static bool IsDerivedFrom (System.Xml.Schema.XmlSchemaType derivedType, System.Xml.Schema.XmlSchemaType baseType, System.Xml.Schema.XmlSchemaDerivationMethod except);
static member IsDerivedFrom : System.Xml.Schema.XmlSchemaType * System.Xml.Schema.XmlSchemaType * System.Xml.Schema.XmlSchemaDerivationMethod -> bool
Public Shared Function IsDerivedFrom (derivedType As XmlSchemaType, baseType As XmlSchemaType, except As XmlSchemaDerivationMethod) As Boolean

參數

derivedType
XmlSchemaType

要測試的衍生 XmlSchemaType

baseType
XmlSchemaType

基底 XmlSchemaType,要對其測試衍生 XmlSchemaType

except
XmlSchemaDerivationMethod

其中一個 XmlSchemaDerivationMethod 值,表示從測試排除的型別衍生方法。

傳回

如果衍生型別是衍生自基底型別,則為 true,否則為 false

範例

以下是 方法的 IsDerivedFrom 範例。

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));  
Dim xsdInteger As XmlSchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Integer)  
Dim xsdPositiveInteger As XmlSchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.PositiveInteger)  

' True  
Console.WriteLine(XmlSchemaType.IsDerivedFrom(xsdPositiveInteger, xsdInteger, XmlSchemaDerivationMethod.None))  

' False  
Console.WriteLine(XmlSchemaType.IsDerivedFrom(xsdPositiveInteger, xsdInteger, XmlSchemaDerivationMethod.Restriction))  

適用於