XElement.LastAttribute Właściwość

Definicja

Pobiera ostatni atrybut tego elementu.

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

Wartość właściwości

XAttribute

Element XAttribute zawierający ostatni atrybut tego elementu.

Przykłady

Poniższy przykład tworzy drzewo XML z trzema atrybutami. Następnie zapisuje ostatni atrybut jako dane wyjściowe.

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)  

Ten przykład generuje następujące wyniki:

Att3="3"  

Uwagi

Atrybuty są przechowywane w elemecie w kolejności, w której zostały dodane do elementu.

Dotyczy

Zobacz też