XElement.Attributes Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Returns a collection of attributes of this element.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
Return Value
Type: System.Collections.Generic.IEnumerable(Of XAttribute)An IEnumerable(Of T) of XAttribute of attributes of this element.
The following example creates an element with two attributes. It then uses this axis method to retrieve all attributes of the element.
Dim output As New StringBuilder Dim xmlTree As XElement = <Root Att1="content1" Att2="content2"/> Dim attList As IEnumerable(Of XAttribute) = _ From at In xmlTree.Attributes() _ Select at For Each att In attList output.Append(att) output.Append(Environment.NewLine) Next OutputTextBlock.Text = output.ToString()
Show: