Extensions.XPathSelectElements Selects a collection of elements using an XPath expression.
using System; using System.Linq; using System.Xml; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; using System.Xml.XPath; using System.IO; public class MainClass{ public static void Main(){ XElement root = new XElement("Root", new XElement("Child1", 1), new XElement("Child1", 2), new XElement("Child1", 3), new XElement("Child2", 4), new XElement("Child2", 5), new XElement("Child2", 6) ); IEnumerable<XElement> list = root.XPathSelectElements("./Child2"); foreach (XElement el in list) Console.WriteLine(el); } }