title: Limit Threads count
body: <p>I have a List with items that I want to download. I use a for Loop to iterate the list.</p>
  
  <p>For each item in this List I start a new Thread that references the item. My Problem is that I want limit the maxDownload at the same time.</p>
  
  <pre><code>for (int i = downloadList.Count - 1; i &gt;= 0; i--)
  {
      downloadItem item = downloadList[i];
      if (item.Status != 1 &amp;&amp; item.Status != 2)
      {
          ThreadStart starter = delegate { this.DownloadItem(ref item); };
          Thread t = new Thread(starter);
          t.IsBackground = true;
          t.Name = item.Name;
          t.Priority = ThreadPriority.Normal;
          t.Start();
      }
  }
  </code></pre>
  
  <p>I read something about the ThreadPool, but then I can't reference my item. Can someone Help me? Thanks! :)</p>
  
  <h2>Edit:</h2>
  
  <p>I tested this:</p>
  
  <pre><code>ThreadPool.SetMaxThreads(maxDownloads, maxDownloads);
  ThreadPool.SetMinThreads(maxDownloads, maxDownloads);
  ThreadPool.QueueUserWorkItem(DownloadItem, ref item);
  </code></pre>
  
  <p>I don't know how I can reference my downloadItem with this thread.....</p>