c# list of strings to string with separator code example

Example 1: c# list to string comma separated

IList<string> strings = new List<string>{"1","2","testing"};
string joined = string.Join(",", strings);

Example 2: c# list to string

List<string> names = new List<string>() { "John", "Anna", "Monica" };
string result = string.Join(",", names.ToArray());

Example 3: c# list to string join

String.Join(" ", elements)

Example 4: c# list join

List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join(", ", names.ToArray());

Example 5: c# join string array

var combined = String.Join(",", new String[]{"a","b"});
// a,b