Code:
public static IEnumerable<IEnumerable<T>> TakeBy<T>(this IEnumerable<T> source, int count) { var grps = source.Select((val, i) => new { idx = i / count, val }).GroupBy(e => e.idx); return grps.Select(g => g.Select(e => e.val)); }
No comments:
Post a Comment