У меня есть объект XElement, созданный из XML, который выглядит следующим образом:
<Root>
<Oppurtunities>
<Oppurtunity>
<Title> Account Manager</Title>
<Company>Company name</Company>
<Location>Boston</Location>
<EndDate>2013-04-11</EndDate>
<c>acce</c>
<id>MNYN-95ZL8L</id>
<Description>This is a detailed description...</Description>
</Oppurtunity>
Теперь мне нужно получить значение описания из определенного узла Oppurtunity, то есть я хочу получить описание из того, где указан идентификатор. Мне нужно сделать что-то вроде этого:
//My XElement object is called oppurtunities
oppurtunities = new XElement((XElement)Cache["Oppurtunities"]);
string id = Request.QueryString["id"];
//I want to do something like this but of course this is not working
var description = (from job in oppurtunities
.Element("Oppurtunities")
.Element("Oppurtunity")
.Element("Description")
where job.Element("id") == id).SingleOrDefault();