title: Preserving Order In Sequence of Choices (LINQ To XSD)
body: <p>Given the following XML example we could imagine a schema defining Root as containing a sequence of unbound number of choices between Type1 and Type2.</p>
  
  <pre><code>&lt;Root&gt;
      &lt;Type1 /&gt;
      &lt;Type2 /&gt;
      &lt;Type2 /&gt;
      &lt;Type1 /&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>I am testing out migrating from the XSD.exe tool which although adds type-safety has a lot of little annoyances.  The XSD tool in this case just creates within Root an array of type System.Object and you have to figure out what type of objects (Type1 or Type2) are in there.  Its not completely elegant, but at least you preserve order.</p>
  
  <p>The problem is when LINQ to XSD creates the objects, it defines Root as having two independent lists of Type1 and Type2.  This is great in that it is type-safe, but I now appear to lose the order of the elements.  I built LINQ to XSD from the source on codeplex.  </p>
  
  <p>Using LINQ to XSD, how can I preserve the order of these elements?</p>