Split array into 8 values

I have an array of multiple values, eg : 30 values

I want to split the array with 8 values each, so for 30 values in an array there will be 4 splits… like 8, 8, 8, 6

Please let me know how to achieve this. The number of values in an array is not fixed, it varies each time but values in each split must contain 8 values

Hope the requirement is clear

@aishwarya1

You can try below expression to take 8 values each time.

            varArray.Skip(skipNumber).Take(takeNumber)

Here skipNumber and takeNumber variables of type Integer. Initiate skipNumber with 0 first and then increment by 8 for every iteration.

Hi,

The following expression might help you.

num =8
arrStr is string array which has 30 items.

Then

arrArrStr = Enumerable.Range(0,1+arrStr.Length \ num).Select(Function(i) arrStr.Skip(i*num).Take(num).ToArray).ToArray

Regards,