Possible Duplicate:
Children of XElement
I want to get child elements from XElement using C#. How can this be done?
Try .Elements()
:
XElement element = GetElement(); var children = element.Elements();
If you want elements from all levels, you may also have a look at Descendants
.
There are a few alternatives to navigate from an XElement
to its children:
IEnumerable<XElement> allChildElements = xElement.Elements(); IEnumerable<XElement> specificChildElements = xElement.Elements("tag"); XElement firstSpecificChildElement = xElement.Element("tag");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With