This article illustrates the different techniques to convert a List<string> to a comma-separated string in C#.

1. Using String.Join() method

The standard solution to convert a List<string> to a comma-separated string in C# is using the string.Join() method. It concatenates members of the specified collection using the specified delimiter between each item.

Download  Run Code

2. Using Enumerable.Aggregate() method

Alternatively, you can use the LINQ Aggregate() method, which applies an accumulator function on each item of the calling sequence. This can be used as follows to concatenate each member of the list. Note that you need to add the System.Linq namespace.

Download  Run Code

That’s all about converting a List<string> to a comma-separated string in C#.