title: Parallel.For not to use my main thread
body: <p>In my application I want my main thread to be not used by anything else. I have to do some parallel processing that I would like to be done by different threads. For that I am using Parallel.For as follows</p>
  
  <pre><code>static void SomeMethod()
  {
      Console.WriteLine(string.Format("Main Thread ID  before parallel loop -&gt;&gt;&gt;&gt;&gt;&gt;&gt; {0} ", System.Threading.Thread.CurrentThread.ManagedThreadId));
      Parallel.For(0, 10, i =&gt;
      {
          Console.WriteLine(string.Format("Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; {0} ", System.Threading.Thread.CurrentThread.ManagedThreadId));
      }); 
      Thread.Sleep(100);
      Console.WriteLine(string.Format("Main Thread ID  after parallel loop -&gt;&gt;&gt;&gt;&gt;&gt;&gt; {0} ", System.Threading.Thread.CurrentThread.ManagedThreadId));
  }
  </code></pre>
  
  <p>As you can see from the output main thread is using ThreadID 1 and some threads from Parallel.For are also using same thread.</p>
  
  <pre><code>Main Thread ID  before parallel loop -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 3
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 4
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 4
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 4
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 4
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 5
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 3
  Output -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1
  Main Thread ID  after parallel loop -&gt;&gt;&gt;&gt;&gt;&gt;&gt; 1
  </code></pre>
  
  <p>Is there some way to make sure that anything in Parallel.For always run on separate thread so that main thread is always free.</p>