I have one xml file with a collection of cars. I want to remove a element A and B if the car is green :
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Cars>
<Car>
<Color>Green</Color>
<A>Value</A>
<B>Value</B>
</Car>
<Car>
<Color>Blue</Color>
<A>Value</A>
<B>Value</B>
</Car>
<Car>
<Color>Yellow</Color>
<A>Value</A>
<B>Value</B>
</Car>
</Cars>
I do :
XDocument.Root.Descendants("Car").Where(x => x.Element("Color").Value == "Green"). Select(x => x.Element("A")).Remove();
XDocument.Root.Descendants("Car").Where(x => x.Element("Color").Value == "Green"). Select(x => x.Element("B")).Remove();
It's work but how to do this in one line ? How to select two elements in Select ?
Thank's