I have a method like:
public void RemoveItem(ObservableCollection<SomeClass> collection, SomeClass instance) { if(collection.Contains(instance)) { collection.Remove(instance); } }
First, even the collection contains an instance, the if clause still returns false .
Secondly, I delete the if clause, just make a collection to remove the instance. And after execution, the collection still retained its original elements, which still include a copy.
Is this a link issue, but how can I fix it? I just want to remove one element from the ObservableCollection and keep its Observable functionality ( which puzzled me here ).
Jerry Bian
source share