Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Before elements

Imports System Imports System.Reflection Imports System.Xml Module Module1     Sub Main()         Dim xml As XElement = XElement.Load("People.xml")         Dim firstName As XElement = xml.Descendants("firstname").First()         Console.WriteLine("Before <firstname>")         For Each tag In firstName.ElementsBeforeSelf()             Console.WriteLine(tag.Name)         Next     End Sub End Module