XDocument doc = XDocument.Load("example.xml"); IEnumerabledescendantNodes = doc.DescendantNodes();
XDocument doc = XDocument.Load("example.xml"); IEnumerableIn this example, the method filters all descendant nodes and selects only the elements with the name "person". Package library: System.Xml.Linq.elements = doc.DescendantNodes() .OfType () .Where(e => e.Name == "person");