title: How to increase performance of foreach loop?
body: <p>How to <em>increase performance</em> (it takes about <strong>10</strong> seconds) of this <em>foreach</em> loop</p>
  
  <pre><code>foreach (var item in pList)
  {
      var foundedItem = source.FirstOrDefault(x =&gt; x.LongRecordId == item.LongRecordId);
      if (foundedItem != null &amp;&amp; !selectionList.Contains(foundedItem))
      {
          foundedItem.Readonly = pReadonly;
          selectionList.Add(foundedItem);
      }
  }
  </code></pre>