I am not sure if this question is really trivial or not but I am trying to find a simple solution to a simple problem without going to any level of complexity. I have a class contains a set of properties with same characterstics and I need to encapsulate them without changing the XML output results, how can I do that?
Old Class Form
Class School
{
public string studentname;
public string studentID
public string roomname;
public string roomID
}
new class format
Class School
{
public Student x;
public Room y
}
class Student
{
public string studentname;
public string studentID
}
class Room
{
public string roomname;
public string roomID
}
XML Format that I need to keep
<School>
<studentname>xxx</studentname>
<studentID>yyy</studentID>
<roomname>zzz</roomname>
<roomID>ddd</roomID>
</School>