#if FAT using System; using System.Collections.Generic; namespace LinqInternal.Collections { internal static partial class Extensions { public static void InsertRange(this TCollection source, int index, T item) where TCollection : class, IList { if (source == null) { throw new ArgumentNullException("source"); } source.Insert(index, item); } public static void InsertRange(this TCollection source, int index, Func item) where TCollection : class, IList { if (source == null) { throw new ArgumentNullException("source"); } if (item == null) { throw new ArgumentNullException("item"); } source.Insert(index, item()); } public static int InsertRange(this TCollection source, int index, IEnumerable items) where TCollection : class, IList { if (source == null) { throw new ArgumentNullException("source"); } if (items == null) { throw new ArgumentNullException("items"); } var initialIndex = index; foreach (var item in items) { source.Insert(initialIndex, item); checked { index++; } } return index - initialIndex; } public static int InsertRange(this TCollection source, int index, IEnumerable> items) where TCollection : class, IList { if (source == null) { throw new ArgumentNullException("source"); } if (items == null) { throw new ArgumentNullException("items"); } var initialIndex = index; foreach (var item in items) { source.Insert(initialIndex, item()); checked { index++; } } return index - initialIndex; } } } #endif