Share via


XElement.LastAttribute Propriedade

Definição

Obtém o último atributo desse elemento.

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

Valor da propriedade

XAttribute

Um XAttribute que contém o último atributo desse elemento.

Exemplos

O exemplo a seguir cria uma árvore XML com três atributos. Em seguida, grava o último atributo como saída.

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)  

Esse exemplo gera a saída a seguir:

Att3="3"  

Comentários

Os atributos são armazenados no elemento na ordem em que foram adicionados ao elemento.

Aplica-se a

Confira também