I am using WCF. I have the following model classes. When the object serialization list cIntList
property Name
is lost. I found the answer here:
When a class is inherited from List<>, XmlSerializer doesn't serialize other attributes.
However, important to me not to build a container class only modify the same serialization. Can anyone help me modify the class so as to allow its serialization in line with my expectations?
public class IntData
{
public int Value;
public IntData()
{
}
}
public class cIntList : List<IntData>
{
public string Name;
public cIntList()
{
Name = "Name";
this.Add(new IntData() { Value = 1 });
this.Add(new IntData() { Value = 2 });
}
}