c# array to comma separated string 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#: convert array of integers to comma separated string

var result = string.Join(",", arr);

Example 3: javascript array to comma separated string

var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(","); //"red,blue,green"

Example 4: convert comma separated string to array c#

string fruit = "Apple,Banana,Orange,Strawberry";
string[] split = fruit.Split(',');