title: WCF XML structure - how to remove wrapper nodes?
body: <p>I am having trouble when using List objects:</p>
  
  <pre><code>[DataContract]
  public class Recipe
  {
          [DataMember(Name="Allergies")]
          public List&lt;AllergyModel&gt; Allergies { get; set; }
  }
  
  [DataContract]    
  public class AllergyModel
  {
      public string Allergy { get; set; }
  }
  </code></pre>
  
  <p>How do I make the XML produced not include the AllergyModel node? When I come to read the Recipe parameter, the Allergies list property is null because in the original XML the structure does not have the AllergyModel node.</p>
  
  <pre><code>&lt;Allergies&gt;
      &lt;a:AllergyModel&gt;
          &lt;a:Allergy&gt;nuts&lt;/a:Allergy&gt;
      &lt;/a:AllergyModel&gt;
      &lt;a:AllergyModel&gt;
          &lt;a:Allergy&gt;wheat&lt;/a:Allergy&gt;
      &lt;/a:AllergyModel&gt;
  &lt;/Allergies&gt;
  </code></pre>