I\'m new to LINQ and XML parsing and rather new to C# programming. For the following XML structure, I\'m trying to extract the nested elements:
You can do it this way using linq:
var result = from p in xmlDoc.Descendants("person") from a in p.Descendants("address") where p.Element("personNumber").Value == "2" select new { City = a.Element("city").Value, Location = a.Element("location").Value };