title: Adding rows inside a loop
body: <p>If I execute the following code fragment:</p>
  
  <pre><code>IXLRange dataRange = worksheet.Range(1, 1, myData.Count, 4);
  foreach (var row in dataRange.Rows()) {
      //int cells = row.CellCount();
      if (isEndOfGroup) {
          row.InsertRowsBelow(1);
          var rowBelow = row.RowBelow();
          // Do stuff with the added row, like adding a subtotal
      }
  }
  </code></pre>
  
  <p>What's actually happening here? It seems like the row collection being iterated on is being updated, which is what I want to happen, because the commented-out line throws an exception with the error "Range is invalid" on the next iteration, as if the row somehow hasn't been initialised yet.</p>
  
  <p>I understand modifying a collection as you iterate through it is bad practice, but I've done this before without any issues. </p>
  
  <p>What would be an alternative way of achieving this?</p>