XElement.FirstAttribute プロパティ

定義

この要素の最初の属性を取得します。

public:
 property System::Xml::Linq::XAttribute ^ FirstAttribute { System::Xml::Linq::XAttribute ^ get(); };
public System.Xml.Linq.XAttribute FirstAttribute { get; }
public System.Xml.Linq.XAttribute? FirstAttribute { get; }
member this.FirstAttribute : System.Xml.Linq.XAttribute
Public ReadOnly Property FirstAttribute As XAttribute

プロパティ値

この要素の最初の属性を格納している XAttribute

次の例では、このプロパティを使用します。

XElement xmlTree = new XElement("Root",
    new XAttribute("Att1", 1),
    new XAttribute("Att2", 2),
    new XAttribute("Att3", 3)
);
Console.WriteLine(xmlTree.FirstAttribute);
Dim xmlTree As XElement = <Root Att1="1" Att2="2" Att3="3"/>
Console.WriteLine(xmlTree.FirstAttribute)

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

Att1="1"

注釈

属性は、 要素に追加された順序で 要素に格納されます。

適用対象

こちらもご覧ください