1

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>
Miral
  • 79
  • 11
  • Looks like someone's already had this problem in the past. In case you haven't done so, try searching your problem on google before asking. https://stackoverflow.com/questions/23919151/xmlarray-serialization-how-can-i-make-the-serializer-ignore-the-class-name-of – Danny Bogers Sep 25 '16 at 09:23
  • Indeed I did, the link does not answer my question. Anyway thanks for your advice. – Miral Sep 25 '16 at 09:27

0 Answers0