join arrays c# code example

Example 1: c# join string array

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

Example 2: c# merging two arrays

T[] array1 = getOneArray();
T[] array2 = getAnotherArray();
T[] newArray = new T[array1.Length + array2.Length];
Array.Copy(array1, newArray, array1.Length);
Array.Copy(array2, 0, newArray, array1.Length, array2.Length);

Example 3: c# add 2 arrays

public static int[] AddArrays(int[] a, int[] b)
{
    int[] newArray = new int[a.Length];
    for (int i = 0; i<a.Length; i++)
    {
        newArray[i]=a[i]+b[i];
    }
    return newArray;
}

Example 4: c# array.join

String Array...
AB
BC
CD
DE
EF
FG
GH
IJ
Result (after joining) = AB*BC*CD*DE*EF*FG*GH*IJ