title: Removing something from a list
body: <p>I am trying to remove something from a list using a counter but it is not working for me.</p>
  
  <pre><code>    int i =0;
      foreach(Rolls rl in rolls)
      {   
          if(rl.getCourseId == courseId &amp;&amp; rl.getStudentId == studentId)
          {
              rolls.RemoveAt(i) ;   
          }
          i++;
      }
  </code></pre>
  
  <p>Can anyone see why this might not work. Its gives me a run time exception:</p>
  
  <p>"Collection was modified; enumeration operation may not execute."</p>