12 lines
No EOL
363 B
C#
12 lines
No EOL
363 B
C#
namespace CS2_SimpleAdmin;
|
|
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static IEnumerable<IEnumerable<T>> ChunkBy<T>(this IEnumerable<T> source, int chunkSize)
|
|
{
|
|
return source
|
|
.Select((x, i) => new { Index = i, Value = x })
|
|
.GroupBy(x => x.Index / chunkSize)
|
|
.Select(x => x.Select(v => v.Value));
|
|
}
|
|
} |