I'm trying to use List.Contains in a List My objects to compare come from a Service Reference in C# and their Equals method doesn't suit my needs.
I've been looking into IEquatables or on how to override my Equals method in an objet I'm "given" but I can't seem to find a solution for this. Does some one know an efficient way to do this?
public void FilterNonExisting(List<ActivitiesActivity> commitActivitiesList)
{
// ActivitiesActivity is the object I'm given through a reference
List<int> itemsToDelete = new List<int>();
int commitCount = 0;
foreach (ActivitiesActivity commitItem in commitActivitiesList)
{
if (this.logList.Contains(commitItem)) // this is the part that doesn't work the way I want it to {
itemsToDelete.Add(commitCount);
}
commitCount++;
}
itemsToDelete.Reverse();
foreach (int item in itemsToDelete)
commitActivitiesList.RemoveAt(item);
if (commitActivitiesList.Count == 0)
{
throw new AllCommitedException("All lines had already been committed");
}