title: Skip a class hierarchy level during XML serialization
body: <p>I want to serialize a class into:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;documents&gt;
    &lt;document&gt;
      &lt;element /&gt;
      ...
    &lt;/document&gt;
    ....
  &lt;/documents&gt;
  </code></pre>
  
  <p>I have been experimenting with the following class hierarchy:</p>
  
  <pre><code>public class A
  {
      [XmlArrayItem("document")]
      public List&lt;B&gt; documents = new List&lt;B&gt;();
  }
  
  public class B
  {
      public string id;
  
      [XmlArray("element")]
      public List&lt;C&gt; elements = new List&lt;C&gt;();
  }
  
  public class C
  {
      public string name;
      public string value;
  }
  </code></pre>
  
  <p>Unfortunately, what I get is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;A&gt;
    &lt;documents&gt;
      &lt;document&gt;
        &lt;element /&gt;
      &lt;/document&gt;
    &lt;/documents&gt;
  &lt;/A&gt;
  </code></pre>
  
  <p>So how do I get rid of "A", i.e. the type name of the outmost class?</p>
  
  <p>A broader question would be, how can this be generalized? How can I skip arbitrary "levels" within my class hierarchies during serialization?</p>