title: Reorder XML nodes
body: <p>I’ve got some XML that looks something like this:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;
      &lt;item&gt;Banana&lt;/item&gt;
      &lt;item&gt;Apple&lt;/item&gt;
      &lt;item&gt;Cherry&lt;/item&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>It’s not the actual data I have, but it’ll serve the purpose here. What I want to do is use Linq to SQL to reorder the XML so that the child nodes are in alphabetical order, eg.</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;
      &lt;item&gt;Apple&lt;/item&gt;
      &lt;item&gt;Banana&lt;/item&gt;
      &lt;item&gt;Cherry&lt;/item&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I want to be able to then call <code>ToString()</code> on the original XDocument and have it return the second set of XML as shown above. Is there a simple way of doing this? I’ve tried searching, but no such luck.</p>