I have the string of comma separated ids like 1,2,3,4,5,6,7,8,9...... etc.
Please suggest how i can split them in group of "Quantity" means if Quantity=3 then group are (List) ["1,2,3"], ["4,5,6"], ["7,8,9"] etc.
Range of Quantity is from 1-75.
I have the string of comma separated ids like 1,2,3,4,5,6,7,8,9...... etc.
Please suggest how i can split them in group of "Quantity" means if Quantity=3 then group are (List) ["1,2,3"], ["4,5,6"], ["7,8,9"] etc.
Range of Quantity is from 1-75.
Try this:
var quantity = 3;
yourList.Select((x, i) => new { Index = i, Value = x })
.GroupBy(x => x.Index / quantity )
.Select(x => x.Select(v => v.Value).ToList())
.ToList();