commadelimitedstringcollection makes nice csv

just posted this here as a reminder to myself or anyone else looking for a quick way to create a comma-seperated string from a list of things.

public static string ListToCsv<T>(List<T> list)
{
CommaDelimitedStringCollection commaStr = new CommaDelimitedStringCollection();
list.ForEach(delegate(T item)
  {
  commaStr.Add(item.ToString());
   });
       return commaStr.ToString();
}
  -edoode
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Monday, December 15, 2008 4:54 PM
Print
Comments have been closed on this topic.
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910