title: What's the VB.NET equivalent of this C# 'for' loop?
body: <p>After two years of C#, my VB.NET is a bit rusty. I have two Lists. Let's call them originalList and targetList. Here is my C# code:</p>
  
  <pre><code>for(int i = 0; i&lt;originalList.Count; i++)
  {
      bool isMatch = false;
      foreach (string t in targetList)
      {
          if(String.Compare(originalList[i], t, true) == 0)
          {
              isMatch = true;
              break;
          }
      }
      if(isMatch)
      {
          originalList.RemoveAt(i);
          i--;
      }
  }
  </code></pre>
  
  <p>And my VB.NET code is this:</p>
  
  <pre><code>Dim i as Integer
  For i = 0 To originalList.Count - 1
      Dim isMatch as boolean = false
      For Each t As String In targetList
          If String.compare(originalList(i), t, true) = 0 Then
              isMatch = true
              Exit For
          End If
      Next
  
      If isMatch Then
          originalList.RemoveAt(i)
          i -= 1
      End If
  Next
  </code></pre>
  
  <p>But I got an index-out-of-range error with my VB.NET code. Where did I get it wrong?</p>