Last active
March 2, 2019 04:44
-
-
Save sawilde/2fc2607ee209fdf65bc0 to your computer and use it in GitHub Desktop.
Break an array into blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blockSize = 2; | |
var blocks = arrayListEnumerableOfThing | |
.Select((element, idx) => new { element, idx }) | |
.GroupBy(x => x.idx / blockSize, x => x.element) | |
.Select(b => b.ToArray()) | |
.ToArray(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment