XNode.IsBefore Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Determines if the current node appears before a specified node in terms of document order.
Assembly: System.Xml.Linq (in System.Xml.Linq.dll)
Parameters
- node
- Type: System.Xml.Linq.XNode
The XNode to compare for document order.
Return Value
Type: System.Booleantrue if this node appears before the specified node; otherwise false.
The following example uses this method.
Dim output As New StringBuilder 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 output.Append("Child5 is before Child3") output.Append(Environment.NewLine) Else output.Append("Child5 is not before Child3") output.Append(Environment.NewLine) End If OutputTextBlock.Text = output.ToString()
Show: