I have an Xelement containing a number of elements.
I have the following code to sort them:
var calculation = from y in x.Elements("row")
orderby y.Element("BUILD_ORDER").Value
select new
{
calcAttribute = y.Element("ELEMENT").Value
};
Which works fine, until BUILD_ORDER > 10, it orders 10 just after 1.
If I want it in strict numerical order, I case the element to an Int, is this the correct way to do it, or does LINQ have an inbuilt extension/method?
orderby Convert.ToInt32(y.Element("BUILD_ORDER").Value)