I have the above XML and code:
XML
Code
var deleteNode = doc.SelectSingleNode("//Library/Game[id='1']");
deleteNode.ParentNode.RemoveAll();
I want to remove the following:
It should look like this after:
The code doesnt seem to be working though :(
Jay

VulpesRank #55 · 29.2K reputationPosted Apr 17, 2011, 1:39 PM EDT
For LINQ to XML, I'd use:
doc.Descendants("Game").Where( e => (string)e.Attribute("id") == "1").Remove();
Jay Webster58 reputationPosted Apr 17, 2011, 2:41 PM EDT
Thanks!