Because all classes that derive from XObject contain a NodeType property, you can write code that operates on collections of concrete subclass of XObject. Your code can then test for the node type of each node in the collection.
Dim output AsNew StringBuilder
Dim el1 As XElement = <Root>content</Root>
output.Append(el1.NodeType.ToString())
output.Append(Environment.NewLine)
OutputTextBlock.Text = output.ToString()