i have two list want to compare and then filter it.
so if list1 contains 1,2,3,4 and list2 2,4 i want to filter list and leave only 1 and 3
HProDataContext db = new HProDataContext();
List<int> _AllRoomsID = (from d in db.rooms select d.id).ToList();
List<int> _ClosedRoomsID = (from d in db.checkinouts select d.roomid).ToList();
for (int i = 0; i < _ClosedRoomsID.Count; i++)
{
if (_AllRoomsID.Contains(_ClosedRoomsID[i]) == true)
{
}
}
Or, if you don’t want an IEnumearble: