title: Keep sort when deserialize and serialize XML using XmlSerializer
body: <p>I have the following test XML string:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;test id="myid"&gt;
   &lt;b&gt;b1&lt;/b&gt;
   &lt;a&gt;a2&lt;/a&gt;
   &lt;a&gt;a1&lt;/a&gt;
   &lt;b&gt;b2&lt;/b&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>which I deserialize using this class:</p>
  
  <pre><code>[XmlRoot(ElementName = "test")]
  public class Test
  {
      [XmlElement(ElementName = "a")]
      public List&lt;string&gt; A { get; set; }
      [XmlElement(ElementName = "b")]
      public List&lt;string&gt; B { get; set; }
      [XmlAttribute(AttributeName = "id")]
      public string Id { get; set; }
  }
  </code></pre>
  
  <p>If I'm now going to serialize the object the result will be:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt;
  &lt;test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="myid"&gt;
    &lt;a&gt;a2&lt;/a&gt;
    &lt;a&gt;a1&lt;/a&gt;
    &lt;b&gt;b1&lt;/b&gt;
    &lt;b&gt;b2&lt;/b&gt;
  &lt;/test&gt;
  </code></pre>
  
  <p>Is there a way to keep the initial sort order? 
  I guess I can't use <code>[XmlElementAttribute(Order = x)]</code> cause the order shouldn't be hardcoded but identically with the initial xml.</p>
  
  <p>I thought about adding an order property to my lists like that</p>
  
  <pre><code>[XmlRoot(ElementName="a")]
  public class A 
  {
      [XmlAttribute(AttributeName="order")]
      public string Order { get; set; }
      [XmlText]
      public string Text { get; set; }
  }
  
  [XmlRoot(ElementName="b")]
  public class B 
  {
      [XmlAttribute(AttributeName="order")]
      public string Order { get; set; }
      [XmlText]
      public string Text { get; set; }
  }
  
  [XmlRoot(ElementName="test")]
  public class Test 
  {
      [XmlElement(ElementName="a")]
      public List&lt;A&gt; A { get; set; }
      [XmlElement(ElementName="b")]
      public List&lt;B&gt; B { get; set; }
      [XmlAttribute(AttributeName="id")]
      public string Id { get; set; }
  }
  </code></pre>
  
  <p>but I don't know how to order by them when serializing.</p>