I have the following XML:
<projects>
<project>
<name>Super 1</name>
<types>
<type>Art</type>
<type>Retro</type>
</types>
</project>
<project>
<name>Super 2</name>
<types>
<type>Retro</type>
</types>
</project>
</projects>
I need to implement SelectProjectsOfType(string type) method. It should return all the <project>‘s XElements with a given type listed as one of their inner <type> in <types> collection. So I need to first analyse the types in each element, and then select an entire project node if the type in search is present. How can this be elegantly done in using LINQ?
1 Answer