Alex Rivera | Logout

Convert a list to a string in C#

Asked 2011-02-12T23:43:17.767
316

How do I convert a list to a string in C#?

When I execute toString on a List object, I get:

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

Edit
Report

1 Answer

2

If you're looking to turn the items in a list into a big long string, do this: String.Join("", myList). Some older versions of the framework don't allow you to pass an IEnumerable as the second parameter, so you may need to convert your list to an array by calling .ToArray().

answered 2011-02-12T23:46:32.813

Your Answer