I have these two lists:
List<image> ImagesByPerimeterId
List<PerimeterTile> ImagesWithMorePerimeters
The context is the following:
I want to remove images that contain the id found in the ImagesWithMorePerimeters list from the ImagesByPerimeterId list. The ImagesWithMorePerimeters list has an imageId attribute to compare with the first one.
I have implemented this logic, and it works very well:
foreach(var i in ImagesByPerimeterId)
{
foreach(var j in ImagesWithMorePerimeters)
{
if (i.Id == j.ImageId)
{
ImagesByPerimeterId.Remove(i);
}
}
}
but I'm looking for a simpler way to compare these lists. Any suggestions?
I tried to use list.Except(), but as the lists are different objects, that did not make it