If both arrays are of the exact same type, you can use:
public static T[] Concatenate<T>(T[] a, T[] b)
{
if (a == null) throw new ArgumentNullException("a");
if (b == null) throw new ArgumentNullException("b");
T[] result = new T[a.Length + b.Length];
Array.Copy(a, result, a.Length);
Array.Copy(b, 0, result, a.Length, b.Length);
return result;
}
Otherwise
public static TResult[] Concatenate<TResult, T1, T2>(T1[] a, T2[] b)
where T1 : TResult where T2 : TResult
{
if (a == null) throw new ArgumentNullException("a");
if (b == null) throw new ArgumentNullException("b");
TResult[] result = new TResult[a.Length + b.Length];
Array.Copy(a, result, a.Length);
Array.Copy(b, 0, result, a.Length, b.Length);
return result;
}
should do.
EDIT:
Maybe Array.Copy() isn't that fast, so it could be benchmarked against LINQ's concat, or a strongly typed version could be custom-made.