Пример #1
0
        public IEnumerable <XNode> DescendantNodes()
        {
            foreach (XNode n in Nodes())
            {
                yield return(n);

                XContainer c = n as XContainer;
                if (c != null)
                {
                    foreach (XNode d in c.DescendantNodes())
                    {
                        yield return(d);
                    }
                }
            }
        }
Пример #2
0
 private static IEnumerable<XElement> Descendants(XContainer doc, string nodeName)
 {
     return doc.DescendantNodes().OfType<XElement>().Where(n => n.Name == nodeName);
 }