-
-
Save duydev/6e2327771c358126d0073cecc48eab2e to your computer and use it in GitHub Desktop.
array chunk c#
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
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