title: Process a list with a loop, taking 100 elements each time and automatically less than 100 at the end of the list
body: <p>Is there a way to use a loop that takes the first 100 items in a big list, does something with them, then the next 100 etc but when it is nearing the end it automatically shortens the "100" step to the items remaining.</p>
  
  <p>Currently I have to use two if loops: </p>
  
  <pre><code>for (int i = 0; i &lt; listLength; i = i + 100)
  {
      if (i + 100 &lt; listLength)
      {
          //Does its thing with a bigList.GetRange(i, 100)
      }
      else
      {
          //Does the same thing with bigList.GetRange(i, listLength - i)
      }
  }
  </code></pre>
  
  <p>Is there a better way of doing this? If not I will at least make the "thing" a function so the code does not have to be copied twice.</p>