title: Removing items from a list when a condition is met
body: <p>I'm writing a multi-threaded download manager where download info is managed by a class I wrote (called DownloadOperation). Downloads are held in a list (called download). I need to remove the objects from the list when a function in the class (queryCompleted) returns true but found out that elements could not be removed from lists from within a <code>foreach</code> loop. What is the best way to have the same effect? I'm relatively new to C# so pardon my stupidity.</p>
  <pre><code>private void removeInactiveDownloads()
      {
          foreach (DownloadOperation dl in download)
          {
              if (dl.queryComplete() == true)
              {
                  // if download is no longer in progress it is removed from the list.
                  download.Remove(dl);
              }
          }
      }
  </code></pre>