I am querying an XMLDocument using SelectNodes(). However, I need the return of the query to be in a particular order based on an element contained inside the nodes being queried. I don’t see any way to do this with SelectNodes method. How can this be accomplished?
Here is my query:
XmlNodeList booksNodes = xmlDoc.DocumentElement.SelectNodes("//BOOKS");
I want to order this by publication date which is an element contained inside the <BOOKS> node.
Try LINQ against your collection of nodes like here: