Durch Komma getrennten Text in linebreak

Ich habe einen Komma-separierten string. Wie kann ich es konvertieren in Zeilenumbruch-format. Mein string ist mag

red,yellow,green,orange,pink,black,white

muss ich dieses format-string zu

red
yellow
green
orange
pink
black
white

hier ist mein code

public static string getcolours()
{
    List<string> colours = new List<string>();
    DBClass db = new DBClass();
    DataTable allcolours = new DataTable();
    allcolours = db.GetTableSP("kt_getcolors");
    for (int i = 0; i < allcolours.Rows.Count; i++)
    {
        string s = allcolours.Rows[i].ItemArray[0].ToString();
        string missingpath = "images/color/" + s + ".jpg";
        if (!FileExists(missingpath))
        {
            colours.Add(s);

        }
    }
    string res = string.Join(", ", colours);

    using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"F:\test.txt", true))
    {

        file.WriteLine(res);
    }
    return res;
}

Weiß jemand, wie man dieses format?

InformationsquelleAutor Arun | 2013-04-25
Schreibe einen Kommentar