I need a resulting XML
like this:
<ListOfStudents>
<ClassOfStudents value="1">
<Student first="asf" last="asf">
<Student first="asf" last="asf">
...
</ClassOfStudents>
<ClassOfStudents value="2">
<Student first="asf" last="asf">
<Student first="asf" last="asf">
...
</ClassOfStudents>
<ClassOfStudents value="3">
<Student first="asf" last="asf">
<Student first="asf" last="asf">
...
</ClassOfStudents>
<ClassOfStudents value="4">
<Student first="asf" last="asf">
<Student first="asf" last="asf">
...
</ClassOfStudents>
<ClassOfStudents value="5">
<Student first="asf" last="asf">
<Student first="asf" last="asf">
...
</ClassOfStudents>
</ListOfStudents>
Till now I have come up with this. But the problem is I can’t figure out how to include types in it?
public class ListOfStudents
{
public ClassOfStudents _ClassOfStudents;
}
public class ClassOfStudents
{
public string Student;
}
The value of types value
, first
, last
would be assigned at the run-time but how should I model my classes to achieve the above XML after serialization?