Search code examples
c#stringlist

Convert a list of strings to a single string


List<string> MyList = (List<string>)Session["MyList"];

MyList contains values like: 12 34 55 23.

I tried using the code below, however the values disappear.

string Something = Convert.ToString(MyList);

I also need each value to be separated with a comma (",").

How can I convert List<string> Mylist to string?


Solution

  • string Something = string.Join(",", MyList);