I have a situation where an end user can enter an XPath to access a value in some XML. I’m using a line of code similar to the one below:
IEnumerable e = (IEnumerable)importDocument.XPathEvaluate(theXPath);
As the Xpath could return an Attribute or an Element, what I need to know is how can I interpret ‘e’ in the above example to decide to cast to an XElement or XAttribute ?