У меня были следующие классы:
Код:
public class Items:List<Item>
{
public Items()
{ }
[XmlIgnore()]
public string prop1 = "";
[XmlElement("prop1")]
public string Prop1
{
get { return prop1; }
set { prop1 = value; }
}
}
public class Item
{
public Item()
{
}
[XmlElement(ElementName = "Prop2")]
public string Prop2 = "";
[XmlElement(ElementName = "Prop3")]
public string Prop3 = "";
[XmlElement(ElementName = "Prop4")]
public string Prop4 = "";
}
And when I serialize the instance of class Items the value of property "Prop1" not serialized. It's a limitation of the .Net Framework Serialization class. But u can do this by another way. It way shown in
MSDN. Find
Purchase Order Example