c# XML Serialization How to serialize flat list with xsi:nil="true"
When serializing a flat List (ie with XmlElement-Attribute) and IsNullable=true, the output doesn't have the xsi:nil="true" entry if the List is null.
[System.Xml.Serialization.XmlElement(IsNullable = true)]
public List<OrdinanceValueType> ordinance
{
get
{
return this.ordinanceField;
}
set
{
this.ordinanceField = value;
}
}
With XmlArray-Attribute, it works, but the list isn't flat anymore.
Is there a way to get xsi:nil="true" with a flat list?
链接地址: http://www.djcxy.com/p/65144.html