var xml=@" <highscore>
<score>
<naam>Pipo</naam>
<punten>200</punten>
</score>
<score>
<naam>Harry</naam>
<punten>400</punten>
</score>
</highscore>";
var doc = XDocument.Parse(xml);
var orderedScoreElements =
doc.Root
.Elements("score")
.OrderByDescending(e => (int)e.Element("punten"))
.ToList();
and to rewrite the doc in order:
doc.Root.RemoveNodes();
doc.Root.Add(orderedScoreElements);
1
solved How to sort numbers in C# XML?