XAttribute.NodeType 属性  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此节点的节点类型。
public:
 virtual property System::Xml::XmlNodeType NodeType { System::Xml::XmlNodeType get(); };public override System.Xml.XmlNodeType NodeType { get; }member this.NodeType : System.Xml.XmlNodeTypePublic Overrides ReadOnly Property NodeType As 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。 然后,代码可以测试集合中每个节点的节点类型。