Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XElement Attributes returns a collection of attributes of this element

Imports System Imports System.Xml Imports System.Xml.XPath Imports System.Collections Imports System.Collections.Generic Public Class MainClass     Public Shared Sub Main()         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             Console.WriteLine(att)         Next     End Sub End Class