4using System.Collections.Generic;
11 public static int IndexOf<TSource>(
this IEnumerable<TSource> source, Func<TSource, bool> predicate)
15 foreach (TSource item
in source)
28 public static object ToUntypedArray(
this IEnumerable<object> value, Type type)
30 Array array = Array.CreateInstance(type, value.Count());
54 public static IEnumerable<T[]>
Group<T>(
this IEnumerable<T> source,
int groupSize)
58 throw new ArgumentOutOfRangeException(nameof(groupSize));
61 T[] group =
new T[groupSize];
64 foreach (T item
in source)
66 group[groupIndex++] = item;
68 if (groupIndex == groupSize)
72 group =
new T[groupSize];
static object ToUntypedArray(this IEnumerable< object > value, Type type)
static bool Empty< TSource >(this IEnumerable< TSource > source)
static int IndexOf< TSource >(this IEnumerable< TSource > source, Func< TSource, bool > predicate)
static IEnumerable< T[]> Group< T >(this IEnumerable< T > source, int groupSize)
Breaks a collection into groups of a specified size.