title: XmlSerializer not serializing custom type
body: <p>I am trying to serialize by following code </p>
  
  <pre><code>var data = argsPerCall.ToArray();
  var knownTypes = new[] { typeof(int), typeof(int),  
                           typeof(string), typeof(McPosition)};
  
  var serializer = new XmlSerializer(data.GetType(), knownTypes);
  // Writing the file requires a TextWriter.
  var myStreamWriter = new StreamWriter(filename);
  serializer.Serialize(myStreamWriter, data);
  myStreamWriter.Close();
  </code></pre>
  
  <p>I am having an issue with <code>McPosition</code> type.</p>
  
  <p>For following input </p>
  
  <pre><code>5 , 1, "R251" , {1,2,3}
  </code></pre>
  
  <p>I am getting following serialization</p>
  
  <pre><code>&lt;ArrayOfAnyType&gt;
      &lt;anyType xsi:type="xsd:int"&gt;5&lt;/anyType&gt;
      &lt;anyType xsi:type="xsd:int"&gt;1&lt;/anyType&gt;
      &lt;anyType xsi:type="xsd:string"&gt;R251&lt;/anyType&gt;
      &lt;anyType xsi:type="McPosition" /&gt;
    &lt;/ArrayOfAnyType&gt;
  </code></pre>
  
  <p>Any idea why it wasnt serialized correctly ?</p>
  
  <p>EDIT:</p>
  
  <pre><code>public struct McPosition : IComparable&lt;McPosition&gt; {
      private readonly int _station;
      private readonly int _slot;
      private readonly int _subslot;
  
  
      public static McPosition Empty = new McPosition(-1, -1, -1);
  
  
      public McPosition(int station, int slot, int subslot) {
        _station = station;
        _slot    = slot;
        _subslot = subslot;
      }
  </code></pre>
  
  <p>etc....</p>
  
  <p>Thanks .</p>