I want to get the highest "ID" attribute from my XML file.
My code is:
var doc = XElement.Load("invoices.xml"); var q = (from f in doc.Element("ListOfInvoices").Elements("Invoice") orderby f.Attributes("ID") descending select f.Attribute("ID")).FirstOrDefault();
When one of the invoice code works in my XML file, but when there are, for example, 2 invoices, I have an error:
At least one object must implement IComparable.
Never source share