I have created a XElement with node which has XML as below.
I want to remove all the \"Rule\" nodes if they contain \"conditions\" node.
I've made a small example for you:
XDocument document = XDocument.Parse(GetXml()); var rulesNode = document.Element("Rules"); if (rulesNode != null) { rulesNode.Elements("Rule").Where(r => r.Element("Conditions") != null).Remove(); }