// Needed for NET40 #if !NET_4_6 using System; using System.Collections.Generic; namespace LinqInternal.Collections { internal static partial class Extensions { public static int AddRange(this ICollection collection, IEnumerable items) { if (collection == null) { throw new ArgumentNullException("collection"); } if (items == null) { throw new ArgumentNullException("items"); } var count = 0; foreach (var item in items) { collection.Add(item); count++; } return count; } public static IEnumerable AddRangeEnumerable(this ICollection collection, IEnumerable items) { if (collection == null) { throw new ArgumentNullException("collection"); } if (items == null) { throw new ArgumentNullException("items"); } foreach (var item in items) { collection.Add(item); yield return item; } } } } #endif