XmlSchemaType.IsDerivedFrom 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回一个值,指示指定的派生架构类型是否从指定的基架构类型派生。
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))