title: C# object<->Data Contract serialization/deserialization adds some unwanted tags
body: <p>I'm facing an annoying situation where my serialization/deserialization isn't as expected.</p>
  
  <p>I want</p>
  
  <pre><code>&lt;OuterClass&gt;
    &lt;Assets&gt;
        &lt;Asset&gt;Asset_A&lt;/Asset&gt;
        &lt;Asset&gt;Asset_B&lt;/Asset&gt;
    &lt;/Assets&gt;
    ...
  &lt;/OuterClass&gt; 
  </code></pre>
  
  <p>but I'm getting</p>
  
  <pre><code>&lt;OuterClass&gt;
    &lt;Assets&gt;
      &lt;Asset&gt;
        &lt;Asset&gt;Asset_A&lt;/Asset&gt;
      &lt;/Asset&gt;
      &lt;Asset&gt;
        &lt;Asset&gt;Asset_B&lt;/Asset&gt;
      &lt;/Asset&gt;
    &lt;/Assets&gt;
    ...
  &lt;/OuterClass&gt;
  </code></pre>
  
  <p>As you can see the Asset tag comes twice.</p>
  
  <p>The code doing this is ..</p>
  
  <pre><code>public class OuterClass
  {
      [DataMember(Name = "Assets", Order = 10)]
      public List&lt;AssetClass&gt; Assets { get; set; }
      ...
      [DataContract(Name = "Asset", Namespace = "")]
      public class AssetClass
      {
          [DataMember(Name = "Asset", Order = 10)]
          public string Asset { get; set; }
          ...
      } 
  }
  </code></pre>
  
  <p>I know I've listed 'Name="Asset"' twice in the code too, but if I take out either of them, the framework adds it's own name inside there still screwing it up. Somehow I suspect I need to change the structure of the code itself but not sure how to do that.</p>
  
  <p>(edit)
  I'm using the in-framework serialization/deserialization helpers. The code for that is (simplified):</p>
  
  <pre><code>public string ToXmlString(OuterClass AssetsWrapper)
  {
      DataContractSerializer ser = new DataContractSerializer(typeof(OuterClass));            
      MemoryStream memStream = new MemoryStream();
  
      // Convert object -&gt; stream -&gt; byte[] -&gt; string (whew!)
      ser.WriteObject(memStream, AssetsWrapper);
      byte[] AssetsWrapperByte = memStream.ToArray();
      return Encoding.UTF8.GetString(AssetsWrapperByte);
  }
  </code></pre>