I need to read and get all the customer ids from the xml. i tried the below code. but returns only one id. i have mentioned by xml file as well. Can anyone help on this issue.
var xdoc = XDocument.Load(@"d:\reply2.xml");
var entries = xdoc.Descendants("customerlist").Select(x => new { custid = (int) x.Element("customerid")});
foreach (var e in entries)
{
Console.WriteLine("Start: {0}", e.custid);
}
Console.ReadLine();
xml file.
<customerlist>
<customerid>1001</customerid>
<customerid>1002</customerid>
<customerid>1003</customerid>
<customerid>1004</customerid>
</customerlist>