CSharp examples for System.Xml:XML Element
Enumerate XML Elements
using System.Xml; using System.Text; using System.Collections.Generic; using System;//from www . java2s.com public class Main{ public static IEnumerable<XmlElement> EnumerateElements(XmlElement source, string childName) { foreach (XmlNode child in source.ChildNodes) { if (child.NodeType == XmlNodeType.Element && childName.Equals(child.LocalName, StringComparison.OrdinalIgnoreCase)) yield return (XmlElement)child; } } }