title: Parallel.Foreach and Parallel Execution in C#
body: <p>I am having a task of scanning all the folders name start with  "xyz" parallely. I meant if one folder getting scan same time other one should also getting scan. I don't want one by one scanning.</p>
  
  <p>For that I used Parallel Foreach.</p>
  
  <p>Question is?
  Is it correct or not? and How to know is it running parallely(to put any message some where)?</p>
  
  <pre><code>Parallel.ForEach(path, currentPath =&gt;
     {
      var output = programReader.GetData(currentPath, durReader.dirPattern);
  
      foreach (var item in output)
        {
          foreach (var project in item.Name)
             Console.WriteLine(item.serverName + " " + item.serverNumber + " " + fileName);
          }
       }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Is Parallel.Foreach only works on multicore systems or it could work on single core system also to perform show parallelism </p>