I
Ilyas
Hi all
I have the following xml file :
<?xml version="1.0" encoding="utf-8" ?>
<root>
<persons>
<person>
<firstname>Mark</firstname>
<surname>Jones</surname>
<age>33</age>
</person>
<person>
<firstname>Adbul</firstname>
<surname>Khan</surname>
<age>30</age>
</person>
<person>
<firstname>Bob</firstname>
<surname>Smith</surname>
<age>31</age>
</person>
</persons>
</root>
I have the following expression
XElement myXml = XElement.Load("Sample.xml");
var allPersonsInOrderOfAge = from person in
myXml.Descendants("person") orderby person.Element("age") select
person;
However when I run this - I get an error saying "At least one object
must implement IComparable"
Can anyone shed any light on this? Is my expression wrong... How can I
correct this problem?
Many thanks
I have the following xml file :
<?xml version="1.0" encoding="utf-8" ?>
<root>
<persons>
<person>
<firstname>Mark</firstname>
<surname>Jones</surname>
<age>33</age>
</person>
<person>
<firstname>Adbul</firstname>
<surname>Khan</surname>
<age>30</age>
</person>
<person>
<firstname>Bob</firstname>
<surname>Smith</surname>
<age>31</age>
</person>
</persons>
</root>
I have the following expression
XElement myXml = XElement.Load("Sample.xml");
var allPersonsInOrderOfAge = from person in
myXml.Descendants("person") orderby person.Element("age") select
person;
However when I run this - I get an error saying "At least one object
must implement IComparable"
Can anyone shed any light on this? Is my expression wrong... How can I
correct this problem?
Many thanks