Answers for "split list into sublists with linq"

0

split list into sublists with linq

public static IList<IList<T>> Split<T>(IList<T> source)
{
    return  source
        .Select((x, i) => new { Index = i, Value = x })
        .GroupBy(x => x.Index / 3)
        .Select(x => x.Select(v => v.Value).ToList())
        .ToList();
}
Posted by: Guest on September-29-2020

Code answers related to "split list into sublists with linq"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language