Set the strings −
List<string> val = new List<string>();
// list of strings
val.Add("water");
val.Add("food");
val.Add("air");Use Join method to convert several strings into a single comma-delimited string −
string.Join(",", val.ToArray());Here is the complete code −
Example
using System;
using System.Collections.Generic;
public class Demo {
public static void Main() {
List<string> val = new List<string>();
// list of strings
val.Add("water");
val.Add("food");
val.Add("air");
string res = string.Join(",", val.ToArray());
Console.WriteLine(res);
}
}Output
water,food,air