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.
StringBuilder output = new StringBuilder();
XComment com = new XComment("This is a comment");
XNode node = com;
output.Append(node.NodeType + Environment.NewLine);
OutputTextBlock.Text = output.ToString();