title: XDocument deleting a node
body: <p>How do I delete a specific node from a loaded XDocument? My XML document looks like this:</p>
  
  <pre><code>&lt;Snippets&gt;
    &lt;Snippet name="if"&gt;
      &lt;SnippetCode&gt;      
   if (condition)
   {
   }
      &lt;/SnippetCode&gt;
  &lt;/Snippet&gt;
  
  &lt;Snippets&gt;
    &lt;Snippet name="foreach"&gt;
      &lt;SnippetCode&gt;      
   ...
      &lt;/SnippetCode&gt;
  &lt;/Snippet&gt;
  
  ....
  
  &lt;/Snippets&gt;
  </code></pre>
  
  <p>So say if I wanted to delete just the foreach snippet, how would I do that? I tried doc.Descendants.Remove(), but it didn't work for me (the node didn't get deleted).</p>
  
  <p>Edit - on that note, how can I also rename the snippet and edit the snippets through code? I haven't looked into that yet but some help would be appreciated.</p>