XElement.LastAttribute プロパティ

定義

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

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

プロパティ値

この要素の最後の属性を含む XAttribute

次の例では、3 つの属性を持つ XML ツリーを作成します。 次に、最後の属性を出力として書き込みます。

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

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

Att3="3"

注釈

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

適用対象

こちらもご覧ください