title: IEnumerable yield return combined with .AsParallel()
body: <p>I've written some code to try and describe my concern:</p>
  
  <pre><code>static void Main(string[] args)
  {
      IEnumerable&lt;decimal&gt; marks = GetClassMarks();
      IEnumerable&lt;Person&gt; students = GetStudents();
  
      students.AsParallel().ForAll(p =&gt; GenerateClassReport(p, marks));
  
      Console.ReadKey();
  }
  </code></pre>
  
  <p>GetClassMarks uses yield return in it from my weird data source.  Assume that GenerateClassReport does basically a marks.Sum()/marks.Count() to get the class average.</p>
  
  <p>From what I understand, students.AsParallel().ForAll is a parallel foreach.</p>
  
  <p>My worry is what is going to happen inside the GetClassMarks method.  </p>
  
  <ul>
  <li>Is it going to be enumerated once or many times?  </li>
  <li>What order is the enumeration going to happen in?</li>
  <li>Do I need to do a .ToList() on marks to make sure it is only hit once?</li>
  </ul>