List to Columns in LINQ

Posted by Sam Saffron on Stack Overflow See other posts from Stack Overflow or by Sam Saffron
Published on 2010-06-02T07:36:13Z Indexed on 2010/06/02 7:53 UTC
Read the original article Hit count: 235

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ