title: Running a simple LINQ query in parallel
body: <p>I'm still very new to LINQ and PLINQ. I generally just use loops and <code>List.BinarySearch</code> in a lot of cases, but I'm trying to get out of that mindset where I can.</p>
  
  <pre><code>public class Staff
  {
    // ...
    public bool Matches(string searchString)
    {
      // ...
    }
  }
  </code></pre>
  
  <p>Using "normal" LINQ - sorry, I'm unfamiliar with the terminology - I can do the following:</p>
  
  <pre><code>var matchedStaff = from s
                       in allStaff
                    where s.Matches(searchString)
                   select s;
  </code></pre>
  
  <p>But I'd like to do this in parallel:</p>
  
  <pre><code>var matchedStaff = allStaff.AsParallel().Select(s =&gt; s.Matches(searchString));
  </code></pre>
  
  <p>When I check the type of <code>matchedStaff</code>, it's a list of <code>bool</code>s, which isn't what I want.</p>
  
  <p>First of all, what am I doing wrong here, and secondly, how do I return a <code>List&lt;Staff&gt;</code> from this query?</p>
  
  <pre><code>public List&lt;Staff&gt; Search(string searchString)
  {
    return allStaff.AsParallel().Select(/* something */).AsEnumerable();
  }
  </code></pre>
  
  <p>returns <code>IEnumerable&lt;type&gt;</code>, not <code>List&lt;type&gt;</code>.</p>