Say I have 23 elements in a list. How can I do foreach taking 5 elements each time and 3 elements the last time? Is there anything like "takeN" method which I can use with foreach or something?
// myList is a list 23 elements
foreach (var x in myList) {
// x is a list with 5 elements
}
See more on this question at Stackoverflow