title: LINQ to remove certain elements from a IList<T> based on a IList<int>
body: <p>How to use LINQ to remove certain elements from a IList based on another IList.
  I need to remove records from list1 where ID is present in list2.
  Below is the code sample,</p>
  
  <pre><code>class DTO
  {
  
      Prop int ID,
      Prop string Name
  }
  
  IList&lt;DTO&gt; list1;
  
  IList&lt;int&gt; list2;
  
  
  
  foreach(var i in list2)
  {
      var matchingRecord = list1.Where(x.ID == i).First();
      list1.Remove(matchingRecord);
  }
  </code></pre>
  
  <p>This is how I am doing it, is there a better way to do the same.</p>