像这样的东西:
XDocument doc; // populate somehow // this will give the names as XName var names = from child in doc.Root.Elements() select child.Name; // if you want just the local (no-namespaces) name as a string, use this var simpleNames = from child in doc.Root.Elements() select child.Name.LocalName;