title: Task based processing with a limit for concurrent task number with .NET 4.5 and c#
body: <p>Following <a href="https://stackoverflow.com/questions/12352560/async-execution-limiting-the-number-of-concurrent-instances/12352930#12352930">this</a>, could anyone post a barebone solution for the following task, targeting .NET 4.5 (and WPF UI on a bigger scale)?</p>
  
  <p>Basically I'm looking for a functional analog of any torrent application implemented on .NET 4.5 and c#.</p>
  
  <p>The task:</p>
  
  <p>I have <code>IEnumerable&lt;IProcessable&gt;</code>, containing 1000 instances of <code>IProcessable</code>, <code>IProcessable</code> has <code>Process(int argument)</code> method, taking from 1 to 10 seconds to execute. I want to loop through the collection and process each instance of <code>IProcessable</code>, limiting the number of concurrently processed instances to N (1..10), number of max concurrent instances should be easily adjustable. Ideally I'd each <code>IProcessable</code> to report about the progress of Process completion, here's a prototype of Process (it probably needs to be converted to something rather than void in order to enable progress reporting):</p>
  
  <pre><code>void Process(int e)
  {
     int progress = 0;
     ...Sleep for 100ms;
     int progress = 30;
     ...Sleep for 100ms;
     int progress = 50;
     ...
  }
  </code></pre>