Concat all strings inside a List<string> using LINQ

Jobi Joy picture Jobi Joy · Feb 18, 2009 · Viewed 444k times · Source

Is there any easy LINQ expression to concatenate my entire List<string> collection items to a single string with a delimiter character?

What if the collection is of custom objects instead of string? Imagine I need to concatenate on object.Name.

Answer

Sedat Kapanoglu picture Sedat Kapanoglu · Feb 18, 2009
String.Join(delimiter, list);

is sufficient.