Split List of Objects at every 8th

I have a variable with type list of objects. How do I split it at every 8th?

in general we are working with skip and take

Find some starter help here:

Also have a look here (done with array, but will also work with lists)

As an alternate we can also present following compact approach:

grafik
we do split into segments (size is 8)
each segment is an array (we can also produce others e.g. list)
all segments are returned as a list

incomplete segments on the end are catched and is handled

mind showing how to adjust your xaml example with it?

Hi,

The following is mostly same as @ppr 's approach. Hope this help you.

Enumerable.Range(0,listObj.Count\8 -CInt(listObj.Count mod 8>0)).Select(Function(i) listObj.Skip(i*8).Take(8).ToList()).ToArray

Sequence.xaml (6.7 KB)

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.