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
/// | |
/// Split a List into smaller lists of N size | |
/// ref → http://stackoverflow.com/questions/11463734/split-a-list-into-smaller-lists-of-n-size | |
/// | |
public static IEnumerable<List<T>> SplitList<T>(List<T> bigList, int nSize = 3) | |
{ | |
for (int i = 0; i < bigList.Count; i += nSize) | |
{ | |
yield return bigList.GetRange(i, Math.Min(nSize, bigList.Count - i)); |