I have an XML
result like this
0
Does this solve your problem:
var test = from c in xml.Descendants("doc")
select new
{
firstname = c.Elements("str").First(element => element.Attribute("name").Value == "ContaFirstname"),
surnmane = c.Elements("str").First(element => element.Attribute("name").Value == "ContaSurname")
};
or, if you want the values (instead of XElement
:
var test = from c in xml.Descendants("doc")
select new
{
firstname = c.Elements("str").First(element => element.Attribute("name").Value == "ContaFirstname").Value,
surnmane = c.Elements("str").First(element => element.Attribute("name").Value == "ContaSurname").Value
};