Articles → .NET → Comma separated list using LINQ

Comma separated list using LINQ









<root>
    <country>India</country>
    <country>Sri Lanka</country>
    <country>Australia</country>
</root>






DataSet ds = new DataSet();
ds.ReadXml(@"C:\Users\guptak\Desktop\CommaSep\CommaSep\XMLFile1.xml");
string str = string.Join(",", (from element in ds.Tables[0].AsEnumerable() select element["country_text"].ToString()).ToArray());
MessageBox.Show(str);









Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Thursday, December 23, 2010

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250