Given the following XML:
<platforms>
<platform>
<id>1</id>
<price>2.99</price>
</platform>
</platforms>
How can I select the platform element as an XElement based on the id child of value 1?
I'm so far away:
XDocument xPlatformXml = new XDocument();
XElement xel = xPlatformXml.Element("platforms").Elements("platform").Where(x => x.Value == "1").SingleOrDefault();
But it looks for the value in the platform element, not the id.
source
share