var split_list = list_data.Select((s, k) => new { s, k })
.GroupBy(x => x.k % numtask)
.Select(g => g.Select(x => x.s).ToList())
.ToList();
public List<List<CMND>> SplitList(List<CMND> locations, int nSize = 8)
{
var list = new List<List<CMND>>();
for (int i = 0; i < locations.Count; i += nSize)
{
list.Add(locations.GetRange(i, Math.Min(nSize, locations.Count - i)));
}
return list;
}