XNode.IsBefore determines if the current node appears before a specified node
Imports System Imports System.Xml Imports System.Xml.Schema Imports System.Linq Imports System.Collections Imports System.Collections.Generic Class MainClass Shared Sub Main() Dim xmlTree As XElement = _ <Root>Text content. <Child1>child1 content</Child1> <Child2>child2 content</Child2> <Child3>child3 content</Child3>More text content. <Child4>child4 content</Child4> <Child5>child5 content</Child5> </Root> Dim child3 As XElement = xmlTree.<Child3>(0) Dim child5 As XElement = xmlTree.<Child5>(0) If (child5.IsBefore(child3)) Then Console.WriteLine("Child5 is before Child3") Else Console.WriteLine("Child5 is not before Child3") End If End Sub End Class