title: XmlSerialization in C# - root element array
body: <p>I would like to de/serialize a XML-Document with type=array as root node.
  The given xml structure looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;parties type="array"&gt;
          &lt;party type="Person"&gt;
              &lt;id&gt;1&lt;/id&gt;
              &lt;lastname&gt;Smith&lt;/lastname&gt;
              &lt;firstname&gt;Peter&lt;/firstname&gt;
              ...
          &lt;/party&gt;
          &lt;party type="Person"&gt;
              &lt;id&gt;2&lt;/id&gt;
              &lt;lastname&gt;Smith&lt;/lastname&gt;
              &lt;firstname&gt;Sarah&lt;/firstname&gt;
              ...
          &lt;/party&gt;
      &lt;parties type="array"&gt;
  </code></pre>
  
  <p>C# Code looks like this:</p>
  
  <pre><code>[XmlRootAttribute("parties", Namespace = "", IsNullable = false)]       
  public class Parties
  {
      private ArrayList contacts = new ArrayList();
  
  
      public Parties()
      {
  
      }
  
  
      [XmlArray("parties"), XmlArrayItem("party", typeof(Person))]
      public ArrayList Contacts
      {
          get { return contacts; }
          set { contacts = value; }
      }
  }
  </code></pre>
  
  <p>The resulting xml output is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;parties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
          &lt;parties&gt;
              &lt;party&gt;
                  &lt;id&gt;0&lt;/id&gt;
                  &lt;lastname&gt;Smith&lt;/last-name&gt;
                  &lt;firstname&gt;Peter&lt;/first-name&gt;
              &lt;/party&gt;
          &lt;/parties&gt;
      &lt;/parties&gt;
  </code></pre>
  
  <p>The problem is that I have 2 -tags now.
  How can I specify array type for the root element? Any ideas how to fix it without changing the given xml schema?</p>