I have a noob LINQ to XML question. I have xml like so:
<pages>
<page Name="Welcome" Control="Welcome" Order="1"></page>
<page Name="Summary" Control="Summary" Order="10"></page>
</pages>
I need to read in the data and save it to an array ordered by the "Order" attribute. Here's what I have; the compiler is coughing on the order by clause.
//read in app.xml data into _Pages
XDocument doc = XDocument.Parse("app.xml");
XElement Pages = (XElement)doc.Descendants("pages");
var Pages1 =
(from page in Pages //<-- error on orderby clause
orderby page.order
select page).ToArray();
I've search SO and found several LINQ to XML answers looking like this, but say something about the xml fragment in an object like Pages. But never show it's type.
Thanks
EDIT: The error is: Could not find an implementation of the query pattern for source type 'System.Xml.Linq.XElement'. 'OrderBy' not found.