/// <summary> /// выбор уникальных значений /// </summary> /// <param name="iter"></param> /// <param name="xpath"></param> /// <returns></returns> public XPathNodeIterator distinct_values(XPathNodeIterator iter, string xpath) { var values = iter.OfType <XPathNavigator>().Select(_ => _.Evaluate(xpath).ToStr()).Distinct(); var xe = new XElement("x"); xe.Add(values.Select(_ => new XElement("v", _))); var nav = xe.CreateNavigator(); return(nav.Select("//v")); }
private static List <string> XPathToStrings(XPathNodeIterator iterator) { return(iterator.OfType <XPathNavigator>().Select(n => n.OuterXml).ToList()); }