How do I delete a specific node from a loaded XDocument? My XML document looks like this:
<Snippets>
  <Snippet name="if">
    <SnippetCode>      
 if (condition)
 {
 }
    </SnippetCode>
</Snippet>
<Snippets>
  <Snippet name="foreach">
    <SnippetCode>      
 ...
    </SnippetCode>
</Snippet>
....
</Snippets>
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).
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.
 
     
     
    