Skip to content

Instantly share code, notes, and snippets.

@sawilde
Last active March 2, 2019 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sawilde/2fc2607ee209fdf65bc0 to your computer and use it in GitHub Desktop.
Save sawilde/2fc2607ee209fdf65bc0 to your computer and use it in GitHub Desktop.
Break an array into blocks
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