TRiBByX
3/13/2017 - 9:50 AM

Splits a list into chunks of a collection

Splits a list into chunks of a collection

public static Collection<List<string>> SplitDict()
{
    int maxChunckSize = DictList.Count / 10;
    int n = 1;
    List<string> chunck = new List<string>();
    foreach (var word in DictList)
    {
        chunck.Add(word);
        if (n++ % maxChunckSize == 0)
        {
            chunckCollection.Add(chunck);
            chunck = new List<string>();
        }
    }
    return chunckCollection;
}