Here is a sample code which shows how to create a comma separated string from List<string>. I know this is not a big deal to do this but in some circumstances it can be used to resolved complex problems.
List<string> lstStr = new List<string>(); lstStr.Add("item1"); lstStr.Add("item2"); lstStr.Add("item3"); lstStr.Add("item4"); lstStr.Add("item5"); lstStr.Add("item6"); string str = string.Join(",", lstStr); MessageBox.Show(str);
Output of this code will be as;
item1,item2,item3,item4,item5,item6
Now you can manipulate this comma separated string as per your needs.
No comments:
Post a Comment