Dec 27, 2013

Convert a list to CSV string

Code to convert list of string to CSV
public static string ToCsv(this IEnumerable source)
{
  if (source == null)
    throw new ArgumentNullException("source");
  return string.Join(",", source.Select(s => s.ToString()).ToArray());
}

No comments:

Post a Comment

Be the first to comment on this post.