XElement.FirstAttribute Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the first attribute of this element.
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
Property Value
An XAttribute that contains the first attribute of this element.
Examples
The following example uses this property.
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)
This example produces the following output:
Att1="1"
Remarks
Attributes are stored in the element in the order that they were added to the element.
Applies to
See also
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage (pull requests). Pour plus d’informations, consultez notre guide du contributeur.