I have xml input which looks like (simplified version used for example):
<Student>
<Subject> History </Subject>
<Subject> English </Subject>
</Student>
Is there a way to get the above xml deserialized to a object whose class looks like:
[Serializable]
[XmlRoot(ElementName = "Student", Namespace="")]
class Student
{
public Student()
{
Subject = new List<string>();
}
public List<string> Subject {get;set;}
}
Note I am trying to figure out if this can be done without having to implement IXmlSerializable interface, and I want to use a list to store the Subject values (not a string [] which I know is possible is I use the XmlElement attribute).