The following DataContract:
[DataContract(Namespace = "http://namespace", Name = "Blarg")]
public class Blarg
{
[XmlAttribute("Attribute")]
public string Attribute{ get; set; }
[DataMember(Name = "Record", IsRequired = false, Order = 4)]
public List<Record> Record{ get; set; }
}
Serializes into this:
<Blarg Attribute="blah">
<Record>
<Record/>
<Record/>
<Record/>
</Record>
</Blarg>
But I want this:
<Blarg>
<Record/>
<Record/>
<Record/>
<Blarg/>
The DataContractSerializer seems to be inserting the header parent automagically and I don't want it.
How do I go about removing the wrapping <Record>
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…