Forum Moderators: open
private string[] combineArrays(string[] arr1, string[] arr2)
{
string[] combArray = new string[arr1.Length + arr2.Length];
for (int i=0; i < arr1.Length; i++)
{
combArray[i] = arr1[i];
}
for (int i=0; i < arr2.Length; i++)
{
combArray[arr1.Length+i] = arr2[i];
}
return combArray;
}
The CopyTo method seems to be much quicker than for loop and manually rebuilding the array... now if I could just find a way to redimension the arr1 so that the first CopyTo is not needed....
private string[] combineArrays(string[] arr1, string[] arr2)
{
string[] combArray = new string[arr1.Length + arr2.Length];
arr1.CopyTo(combArray,0);
arr2.CopyTo(combArray,arr1.Length);
return combArray;
}