我有一些
XML
<Users> <User Name="Z"/> <User Name="D"/> <User Name="A"/> </User>
解决方法
@H_404_9@ 您可以使用LINQ to Xml排序,如果不是XmlDocumentXDocument input = XDocument.Load(@"input.xml"); XDocument output = new XDocument( new XElement("Users",from node in input.Root.Elements() orderby node.Attribute("Name").Value descending select node));