title: Why isn't Parallel.ForEach running multiple threads?
body: <p>Today i tried do some optimization to <code>foreach</code> statement, that works on <code>XDocument</code>.</p>
  
  <p>Before optimization:</p>
  
  <pre><code>foreach (XElement elem in xDoc.Descendants("APSEvent").ToList())
  {
      //some operations
  }
  </code></pre>
  
  <p>After optimization:</p>
  
  <pre><code>Parallel.ForEach(xDoc.Descendants("APSEvent").ToList(), elem =&gt;
  {
      //same operations
  });
  </code></pre>
  
  <p>I saw that .NET in <code>Parallel.ForEach(...)</code> opened ONLY one thread! As a result the timespan of <code>Parallel</code> was bigger than standard <code>foreach</code>.</p>
  
  <p>Why do you think .NET only opened 1 thread? Because of locking of file?
  Thanks</p>