c# join array
// C# program to demonstrate the
// Join(String, Obj [ ]) method
using System;
namespace ConsoleApplication1 {
class Geeks {
// Main Method
static void Main(string[] args)
{
// Creating an object array
// Here, It is consist of four
// elements only
object[] array = {"Hello", "Geeks", 12345, 786};
// Using Join method
// Here separator is ', '( comma )
string s1 = string.Join(", ", array);
// Finally after joining process gets over
// Getting the output of value of string s1
Console.WriteLine("Value of string s1 is " + s1);
}
}
}
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);
}
}