0

WCF DataMember List<> without enclosing element

The following DataContract:

[DataContract(Namespace = "http://namespace", Name = "Blarg")]
public class Blarg
{
    [XmlAttribute("Attribute")]
    public string Attribute{ get; set; }

    [DataMember]
    public List<Record> Records{ get; set; }
}

Serializes into this:

<Blarg Attribute="blah">
    <Records>
        <Record/>
        <Record/>
        <Record/>
    </Records>
</Blarg>

But I would like this:

 <Blarg>
    <Record/>
    <Record/>
    <Record/>
 <Blarg/>
Draken
  • 3,134
  • 13
  • 34
  • 54
koho
  • 1

0 Answers0