Wednesday, October 30, 2013

Find difference between two custom list objects



public class Details
{
public String classNAme;
public List<Student> studentCollection;
}
public class Student
{
public string Rollnumber, Name;
public List<Marks> studentMarks;
}
public class Marks
{
public string Eng, Maths, Term;
}



Old XML
----------
<Details>
<Class>1.0</Class>
<Student RollNumber="001" Name="Aaa">
<Marks Eng="50" Maths="50" Term="First"/>
<Marks Eng="60" Maths="57" Term="Second"/>
<Marks Eng="55" Maths="56" Term="Third"/>
<Marks Eng="59" Maths="85" Term="Fourth"/>
</Student>
<Student RollNumber="002" Name="Baa">
....
</Student>
</Details>
New XML
----------
<Details>
<Class>1.0</Class>
<Student RollNumber="001" Name="Aaa">
<Marks Eng="50" Maths="60" Term="First"/>
<Marks Eng="60" Maths="57" Term="Second"/>
<Marks Eng="55" Maths="46" Term="Third"/>
<Marks Eng="59" Maths="85" Term="Fourth"/>
</Student>
<Student RollNumber="002" Name="Baa">
....
</Student>
</Details>

HI All, Using XELement.Load I have loaded the xml into the above class. My class and XML structure are given above.
I have a requirement where I have to compare two xml files. In hte new XML, Marks for a student(s) might change for a particular term(s).
I need to identify the student and the term for which eth marks has been chnaged.
can u plz let me knwo how to get the difference between tow list<Marks> object.
I would be holding hte object like,
Details oldDetails = GetDetails(path1);
Details newDetails = GetDetails(path2);
Thanks,




No comments:

Post a Comment