csharp list join
Code Example - csharp list join
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join(", ", names.ToArray());
csharp join string array
var combined = String.Join(",", new String[]{"a","b"});
// a,b
csharp program that joins List of strings
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
// Create a List of 3 strings.
var list = new List<string>() { "cat", "dog", "rat" };
// Join the strings from the List.
string joined = string.Join<string>("*", list);
// Display.
Console.WriteLine(joined);
}
}
csharp string array to string
string[] test = new string[2];
test[0] = "Hello ";
test[1] = "World!";
string.Join("", test);
csharp array to string
string.Join(",", Client);
csharp array.join
using System;
public class Demo {
public static void Main(string[] args) {
string[] strArr = {"AB", "BC", "CD", "DE", "EF", "FG", "GH", "IJ" };
Console.WriteLine("String Array...");
foreach(string s in strArr) {
Console.WriteLine(s);
}
string str = string.Join("*", strArr);
Console.WriteLine("Result (after joining) = " + str);
}
}