Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #list #sublists #linq
ADD COMMENT
Topic
Name
1+5 =