title: Call API in parallel loop
body: <p>I am using a parallel loop for posting data to API from C#, having 1000+ objects in the list. The response is either success or failure only. I need to log failed record in the log file with appropriate ID. When I am sending the object to API, I keep the ID in local variable inside the loop and posting the data. When the response comes back, I am assuming that the response what I am getting for that ID and writing the log.</p>
  <pre><code>ParallelOptions po = new ParallelOptions
  {
      MaxDegreeOfParallelism = 2
  };
  Parallel.ForEach(lstPost, po, obj=&gt;
  {
      string id= obj.Id;
      var response= API calls goes here......;
      if(response.Status== &quot;ERROR&quot;)
      {
      //log the details
       Log.Write(ID : response.Status)
      }
  }
  </code></pre>
  <p>My doubt is, there is any chance to get someone else's response to someone else's id?</p>