Using Linq, XML: I loaded the xml file and everything worked until I added the orderby clause. Could you point out my error? Compilation was OK but nothing is shown in the listbox where the results are supposed to be listed. Without the orderby, listbox is populated with entries as expected. Each Name is associated with a unique Code but Code is not part of select new {…}.
var products = from d in xElem.Descendants(fileName)
where d.Element(Name) != null
orderby d.Element(Code) ascending
select new
{
...
name = d.Element(Name).Value
}
d.Element(Code)should bed.Element(Code).Value