title: How to Update a list with another list efficiently C#
body: <p>I have two lists that have object elements, one big list let's call it List1 and another small list List2.
  I need to update values in List1 with values in List2 based on a condition that is defined in a function that returns a boolean based on the values in the objects.
  I have come up with the following implementation which is really taking a lot of time for larger lists.</p>
  
  <p><strong>function to check whether an item will be updated</strong></p>
  
  <pre><code>private static bool CheckMatch(Item item1, Item item2) { 
  //do some stuff here and return a boolean
  }
  </code></pre>
  
  <p><strong>query I'm using to update the items</strong></p>
  
  <p>In the snippet below, I need to update List1(larger list) with some values in List2(small list)</p>
  
  <pre><code>    foreach(var item1 in List1)
      {
          var matchingItems = List2.Where(item2 =&gt; CheckMatch(item1, item2));
          if (matchingItems.Any())
          {
              item1.IsExclude = matchingItems.First().IsExcluded;
              item1.IsInclude = matchingItems.First().IsIncluded;
              item1.Category = matchingItems.First().Category;
          }
      }
  </code></pre>
  
  <p>I'm hoping I will get a solution that is much better than this. I also need to maintain the position of elements in List1</p>
  
  <p>Here is sample of what I'm doing
  <a href="https://repl.it/repls/SimplisticIdenticalCensorware" rel="nofollow noreferrer">Here is sample of what I'm doing</a></p>