You have to move .Element("Description")
further in your query, to allow id
condition work:
//I want to do something like this but of course this is not working
var description = (from job in oppurtunities
.Element("Oppurtunities")
.Elements("Oppurtunity")
where job.Element("id") == id
select job.Element("Description")).SingleOrDefault()
To compare Element("id")
as a string use (string)XElement
conversion - it's gonna work even when <id>
won't be found:
where (string)job.Element("id") == id
Using XElement.Value
will throw NullReferenceException
in that situation.