title: C# Array XML Serialization
body: <p>I found a problem with the XML Serialization of C#. The output of the serializer is inconsistent between normal Win32 and WinCE (but surprisingly WinCE has the IMO correcter output). Win32 simply ignores the  Class2 <code>XmlRoot("c2")</code> Attribute.</p>
  
  <p>Does anyone know a way how to get the WinCE like output on Win32 (because i don't want the XML tags to have the class name of the serialization class).</p>
  
  <p>Test Code:</p>
  
  <pre><code>using System;
  using System.Xml.Serialization;
  using System.IO;
  
  namespace ConsoleTest
  {
      [Serializable]
      [XmlRoot("c1")]
      public class Class1
      {
          [XmlArray("items")]
          public Class2[] Items;
      }
  
      [Serializable]
      [XmlRoot("c2")]
      public class Class2
      {
          [XmlAttribute("name")]
          public string Name;
      }
  
      class SerTest
      {
          public void Execute()
          {
              XmlSerializer ser = new XmlSerializer(typeof (Class1));
  
              Class1 test = new Class1 {Items = new [] {new Class2 {Name = "Some Name"}, new Class2 {Name = "Another Name"}}};
  
              using (TextWriter writer = new StreamWriter("test.xml"))
              {
                  ser.Serialize(writer, test);
              }
          }
      }
  }
  </code></pre>
  
  <p>Expected XML (WinCE generates this):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;c1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;items&gt;
      &lt;c2 name="Some Name" /&gt;
      &lt;c2 name="Another Name" /&gt;
    &lt;/items&gt;
  &lt;/c1&gt;
  </code></pre>
  
  <p>Win32 XML (seems to be the wrong version):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;c1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;items&gt;
      &lt;Class2 name="Some Name" /&gt;
      &lt;Class2 name="Another Name" /&gt;
    &lt;/items&gt;
  &lt;/c1&gt;
  </code></pre>