Skip to content

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

Updated: at 11:18 PM

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

 List<string> strings = new List<string>
	<span class="str">&quot;a&quot;</span>,<span class="str">&quot;b&quot;</span>,<span class="str">&quot;c&quot;</span>


To something that looks like:


Here is the trick using the foreach syntax:

 var stringBuilder = new StringBuilder();