/// <summary> /// Copy all my elements to the given array starting at the given index. /// </summary> /// <param name="collection">Source to copy from</param> /// <param name="array">Array to copy my elements into.</param> /// <param name="index">Position in <see cref="array"/> where the first element will be copied to.</param> public static void CopyTo <E>(Java.Util.ICollection <E> collection, E[] array, int index) { if (index == 0) { collection.ToArray(array); } else { var all = collection.ToArray(new E[0]); for (var i = 0; i < all.Length; i++) { array[index + i] = all[i]; } } }
// Methods public static void CopyTo <E>(Java.Util.ICollection <E> collection, E[] array, int index) { if (index == 0) { collection.ToArray <E>(array); } else { E[] localArray = collection.ToArray <E>(new E[0]); for (int i = 0; i < localArray.Length; i = (int)(i + 1)) { array[index + i] = localArray[i]; } } }
/// <summary> /// Copy all my elements to the given array starting at the given index. /// </summary> /// <param name="collection">Source to copy from</param> /// <param name="array">Array to copy my elements into.</param> /// <param name="index">Position in <see cref="array"/> where the first element will be copied to.</param> public static void CopyTo <E>(Java.Util.ICollection <E> collection, Array array, int index) { var all = collection.ToArray(new E[0]); for (var i = 0; i < all.Length; i++) { array[index + i] = all[i]; } }