I have a XML file, like this:
<?xml version="1.0" encoding="utf-8" ?>
<ROOT>
<NAME>
ItemName
</NAME>
<LIST>
<ITEM>
ListItem1
</ITEM>
<ITEM>
ListItem2
</ITEM>
<ITEM>
ListItem3
</ITEM>
</LIST>
</ROOT>
How can I use LINQ to get all the ITEMs inside the LIST tag?
Something like:
That will cope with multiple “LIST” elements, and won’t find “ITEM” elements except directly under “LIST” ones. If you don’t care about those finer points you could just use: