This project has moved and is read-only. For the latest updates, please go here.

Add method : string ConvertToCsvStr<T>(IEnumerable<T> iEnumerable) - converts collection elements to csv string


so List<string> elements "a","b","c" will be returned as "a;b;c".
Proposal of code, but I don't have idea what class should it be extension to :
    public static string ConvertToCsvStr<T>(IEnumerable<T> iEnumerable)
        string csv = "";
        IEnumerator<T> ie = iEnumerable.GetEnumerator();
        if (ie.MoveNext())
            csv += ie.Current.ToString();
            while (ie.MoveNext())
                csv += ";" + ie.Current;
        return csv;


crpietschmann wrote Mar 16, 2013 at 11:48 AM

This sounds like a good extension method to add, but CSV serialization is more complex than it seems at first sight. There are whole libraries dedicated to just this sort of thing; for example

I'm not sure this is something I want to tackle with dotNetExt. It may be out of the overall scope of this project.