Small LINQ Trick for Converting List<String> to String Text List

Posted by Peter Kellner on February 24, 2010 · 2 mins read

Here is a shorthand way for converting a list of strings defined as follows:

 List<string> strings = new List<string>


To something that looks like:


Here is the trick using the foreach syntax:

 var stringBuilder = new StringBuilder();