Selects a collection of elements using an XPath expression.
Imports System Imports System.Xml Imports System.Xml.XPath Imports System.Linq Imports System.Collections Imports System.Collections.Generic Public Class MainClass Public Shared Sub Main() Dim root As XElement = _ <Root> <Child1>1</Child1> <Child1>2</Child1> <Child1>3</Child1> <Child2>4</Child2> <Child2>5</Child2> <Child2>6</Child2> </Root> Dim list As IEnumerable(Of XElement) = root.XPathSelectElements("./Child2") For Each el As XElement In list Console.WriteLine(el) Next End Sub End Class