using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace ConsoleApp15 { class Program { static void Main(string[] args) { string strXML = @" <doc> <ext>Type:A</ext> <ext>Type:B</ext> </doc>"; XElement myXML = XElement.Parse(strXML); IEnumerable<XElement> xElementData = from data in myXML.Descendants("ext") where data.Value.Contains("Type:A") select data; foreach (XElement xElement in xElementData) { Console.WriteLine(xElement.Value); } Console.ReadKey(); } } }POI:
IEnumerable