Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

XAttribute PreviousAttribute Property gets the previous attribute of the parent element

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim root As XElement = <Root Att1="1" Att2="2" Att3="3" Att4="4"/>         Dim att As XAttribute = root.LastAttribute         Dim val As Boolean = True         Do             Console.WriteLine(att)             att = att.PreviousAttribute         Loop While (Not (att Is Nothing))     End Sub End Class