title: Splitting a list or collection into chunks
body: <p>I have a program that will read the contents of a file into some sort of list or array.  This list/array could contain any number of items.  I need to split it into smaller groups, say of 50 items each and then do some processing on each item in each group.</p>
  
  <pre><code>List&lt;string&gt; stuffFromFile = new List&lt;string&gt;();
  
  while ((line = fileReader.ReadLine()) != null)
        {
             stuffFromFile.Add(line);
        }
  </code></pre>
  
  <p>I have been looking through some examples online about how to chunk stuff but to be honest, I don't really understand the examples and some of them seem overly complex.  I just need something simple that will chunk/split/break the original list of items into groups of 50 and then let me iterate through each item in each group until the processing is complete.</p>
  
  <p>The total number of items read in will most likely not be a number that I can divide evenly by 50 so most likely the last group may contain less than 50 items, but would still need to be processed just like the rest.</p>
  
  <p>Can anyone help here?  It sounds like it should be simple but I don't really know how to do it.  I've seen example about using LINQ but I don't understand it either.</p>