XElement.LastAttribute Proprietà

Definizione

Ottiene l'ultimo attributo di questo elemento.

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

Valore della proprietà

Oggetto XAttribute contenente l'ultimo attributo di questo elemento.

Esempio

Nell'esempio seguente viene creato un albero XML con tre attributi. Scrive quindi l'ultimo attributo come output.

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)

In questo esempio viene generato l'output seguente:

Att3="3"

Commenti

Gli attributi vengono archiviati nell'elemento nell'ordine in cui sono stati aggiunti all'elemento .

Si applica a

Vedi anche