I want to select an element within my XML based on the value of a nest element.
Here is an example of the XML:
<Agents>
<Agent ID="xxx">
<Login>xxx</Login>
<Password>xxxx</Password>
<Products>
<Product ID="zzz">
</Product>
</Products>
</Agent>
</Agents>
Here is my first attempt at a LINQ query:
var DetailsOfUserAccount =
from agent in policySpecificationXml
.Descendants("Agent")
.FirstOrDefault(p => (string)p.Attribute("ID") == productId)
.Descendants()
select new
Thanks.