/// <summary> /// Inserts a collection of elements into an array /// </summary> /// <typeparam name="T">The element type of the array and collection</typeparam> /// <param name="array">The array to insert into</param> /// <param name="collection">The collection to insert</param> /// <param name="index">The index to insert at</param> private static void SafeCall <T>(ref T[] array, T[] collection, int index) { Resize.Call(ref array, array.Length + collection.Length); for (int i = array.Length - 1; i >= index; i--) { if (i == index) { for (int j = 0; j < collection.Length; j++) { array[i + j] = collection[j]; } } else { if (!(i < collection.Length)) { array[i] = array[i - collection.Length]; } } } }