XElement.FirstAttribute Propriedade

Definição

Recebe o primeiro atributo deste elemento.

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

Valor de Propriedade

An XAttribute que contém o primeiro atributo deste elemento.

Exemplos

O exemplo seguinte utiliza esta propriedade.

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)

Este exemplo produz a seguinte saída:

Att1="1"

Observações

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

Aplica-se a

Ver também