<root> 
<row> 
  <linksclicked>http://www.examiner.com/</linksclicked> 
  <clickedcount>34</clickedcount>
</row> 
<row> 
  <linksclicked>http://www.sample123.com</linksclicked> 
  <clickedcount>16</clickedcount>
</row> 
<row> 
  <linksclicked>http://www.testing123.com</linksclicked> 
  <clickedcount>14</clickedcount>
</row> 
</root>
I have xml like above in a string and i have class like below
public class Row
{
    public string linksclicked { get; set; }
    public int clickedcount { get; set; }
}
How can i convert the xml string to a list of Row Object
You can use LINQ to XML:
var doc = XDocument.Parse(xmlString);
var items = (from r in doc.Root.Elements("row")
             select new Row()
                 {
                     linksclicked = (string) r.Element("linksclicked"),
                     clickedcount = (int) r.Element("clickedcount")
                 }).ToList();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With