Last active
June 1, 2017 05:11
-
-
Save wescleymatos/a7e9955af20fda4e78b1 to your computer and use it in GitHub Desktop.
array chunk c#
This file contains hidden or 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
public static IEnumerable<IEnumerable<T>> Split<T>(this T[] array, int size) | |
{ | |
for (var i = 0; i < (float)array.Length / size; i++) | |
{ | |
yield return array.Skip(i * size).Take(size); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment