Return to Snippet

Revision: 54235
at December 16, 2011 02:08 by Neven


Initial Code
List<string> someStrings = new List<string>(new string[] {"This", "will", "concatenate", "strings."});

var concatenatedString = someStrings.Agregate((current, next) => string.Concat(current," ",next));

Console.Write(concatenatedString);

// result: This will concatenate strings.

Initial URL

                                

Initial Description
This code demonstrates how to concatenate list of strings using lambda expression without need to use a loop.

Initial Title
Concatenate strings inside list of strings

Initial Tags
list

Initial Language
C#