title: Sort list2 by list1
body: <p>I have list 1:</p>
  
  <pre><code>"John Doe"
  "Jack Smith"
  "Peter Miller"
  </code></pre>
  
  <p>and by using a function on each item:</p>
  
  <pre><code>List&lt;Person&gt; list2 = new List&lt;Person&gt;();
  foreach(string name in list1) list2.Add(GetPersonByName(name));
  </code></pre>
  
  <p>I produced list 2 (shortened, the real one has 30+ properties):</p>
  
  <pre><code>{Name:"John Doe", Age:55, RoomNo:203}
  {Name:"Jack Smith", Age:40, RoomNo:203}
  {Name:"Peter Miller", Age:31, RoomNo:202}
  </code></pre>
  
  <p>So far, so good.</p>
  
  <p>Now I decided to parallelize the execution:</p>
  
  <pre><code>List&lt;Person&gt; list2 = new List&lt;Person&gt;();
  Parallel.ForEach(list1, person =&gt; { list2.Add(GetPersonByName(name)); });
  </code></pre>
  
  <p>which may result in an unordered list2.</p>
  
  <p>How can I efficiently sort list2 to the same order that list1 had?</p>
  
  <p>Or is there a way to tell the parallel foreach to do the list2.Add in the order of the input list? (The <code>GetPersonByName</code> function is the heavy one - but not calculation, mostly waiting.)</p>