I have XML which looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<University>
<Colleges>
<College>
<Id> Cambridge </Id>
<Dept>
<Id> Arts</Id>
</Dept>
</College>
<College>
<Id> Oxford</Id>
<Dept>
<Id> Philosophy </Id>
</Dept>
</College>
</Colleges>
</University>
I want to return the College based on the ID. In another scenario, I want to written just Id of the College.
I do not understand how to write LINQ statement to read Id directly. I can use Descendants() at every stage. But how to select the element which is deep inside the XML structure?
LINQ-XML,