Let's say I have a List of the following:
a
b
c
d
e
f
g
h
i
j
k
Now I want to split this into, let's say two parts. There are 11 items in the list, so the first sublist would contain 5 items, and the second sublist would contain 6 items.
How would I go about to achieve this result?
var subList1 = list.Take(5).ToList();andvar subList2 = list.Skip(5).ToList();perhaps? You haven't defined any kind of pattern, so just break the values into the two lists as desired.int chunkSize = 1+(list.Count-1)/numberOfChunks;