List to Columns in LINQ
- by Sam Saffron
Given an IEnumerable<T> and row count, I would like to convert it to an IEnumerable<IEnumerable<T>> like so:
Input:
Row Count: 3
List: [1,2,3,4,5,6,7]
Output
[
[1,4,7]
[2,5]
[3,6]
]
How can I do this using LINQ?