I am a newbie and trying to retrieve all the values of file node based on below xml.
<Changes>
<Change id="Rest">
<Name>Restructure</Name>
<TIDE>
<Files>
<File>REGION</File>
</Files>
</TIDE>
<Click>
<Files>
<File>DISTRICT</File>
</Files>
</Click>
</Change>
<Change id="st">
<Name>New ST</Name>
<TIDE>
<Files>
<File>REGION</File>
</Files>
</TIDE>
<Click>
<Files>
<File>DISTRICT</File>
</Files>
</Click>
</Change>
</Changes>
The code I am using is giving me an error "Sequence contains no elements". I have tried to build this code by searching couple of examples on this forum. Can some one help me, much appreciated.
var items = (from i in xmldoc.Root.Elements("Change")
where (string)i.Element("Name").Value == listBox1.SelectedValue.ToString()
select i).First().Elements("File").ToList();