Split a List into smaller lists of N size

前端 未结 17 1841
后悔当初
后悔当初 2020-11-22 16:55

I am attempting to split a list into a series of smaller lists.

My Problem: My function to split lists doesn\'t split them into lists of the correct

17条回答
  •  无人共我
    2020-11-22 17:44

    how about:

    while(locations.Any())
    {    
        list.Add(locations.Take(nSize).ToList());
        locations= locations.Skip(nSize).ToList();
    }
    

提交回复
热议问题