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,

class DTO
{

    Prop int ID,
    Prop string Name
}

IList<DTO> list1;

IList<int> list2;



foreach(var i in list2)
{
    var matchingRecord = list1.Where(x.ID == i).First();
    list1.Remove(matchingRecord);
}

This is how I am doing it, is there a better way to do the same.

Edit
Report