Returns a filtered collection of elements containing this element and all descendant elements of this element
Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.Linq
Imports System.Collections
Imports System.Collections.Generic
Public Class MainClass
Public Shared Sub Main()
Dim xmlTree As XElement = _
<Root Att1="AttributeContent">
<Child>Some text
<GrandChild>element content</GrandChild>
</Child>
</Root>
Dim das As IEnumerable(Of XElement) = xmlTree.DescendantsAndSelf("Child")
For Each el In das
Console.WriteLine(el.Name)
Next
End Sub
End Class