c# - XElement: a collection of all the leaves? -


How to obtain a collection of all the leaves of a XElement tree, regard the hierarchy? Thanks

What is the way you are after?

This all descendants - to get only the leaves, you get a where section:

  element.Descendants () With LINQ can use the object. (Desc = & gt ;! Des.Elements (.) Anyone ());  

(Note that this is still the only element, not other nodes like text node. Hope is ok.)


Comments

Popular posts from this blog

c# - PInvoke of NetUserAdd returns 24 -

c# - XMLDocument.Validate Error: System.InvalidOperationException : The XmlSchemaSet on the document is either null or has no schemas in it -