[c#] Saving lists to txt file

I'm trying to save a list to a text file.

This is my code:

public void button13_Click(object sender, EventArgs e)
{
    TextWriter tw = new StreamWriter("SavedLists.txt");

    tw.WriteLine(Lists.verbList);
    tw.Close();
}

This is what I get in the text file:

System.Collections.Generic.List`1[System.String]

Do I have to use ConvertAll<>? If so, I'm not sure how to use that.

This question is related to c# list

The answer is


Framework 4: no need to use StreamWriter:

System.IO.File.WriteAllLines("SavedLists.txt", Lists.verbList);

@Jon's answer is great and will get you where you need to go. So why is your code printing out what it is. The answer: You're not writing out the contents of your list, but the String representation of your list itself, by an implicit call to Lists.verbList.ToString(). Object.ToString() defines the default behavior you're seeing here.