XAttribute.NodeType プロパティ

定義

このノードのノード型を取得します。

public:
 virtual property System::Xml::XmlNodeType NodeType { System::Xml::XmlNodeType get(); };
public override System.Xml.XmlNodeType NodeType { get; }
member this.NodeType : System.Xml.XmlNodeType
Public Overrides ReadOnly Property NodeType As XmlNodeType

プロパティ値

XmlNodeType

ノード型。 XAttribute オブジェクトでは、この値は Attribute です。

次の例では、属性を作成し、このプロパティを使用してノードの種類を表示します。

XElement root = new XElement("Root",  
    new XAttribute("Att", "content")  
);  

XAttribute att = root.FirstAttribute;  
Console.WriteLine(att.NodeType);  
Dim root As XElement = <Root Att="content"/>  
Dim att As XAttribute = root.FirstAttribute  
Console.WriteLine(att.NodeType.ToString)  

この例を実行すると、次の出力が生成されます。

Attribute  

注釈

派生 XObject 元のすべてのクラスにはプロパティが NodeType 含まれているため、.の具象サブクラス XObjectのコレクションを操作するコードを記述できます。 その後、コードでコレクション内の各ノードのノードの種類をテストできます。

適用対象

こちらもご覧ください