I have some method like:
public void RemoveItem(ObservableCollection<SomeClass> collection, SomeClass instance)
{
if(collection.Contains(instance))
{
collection.Remove(instance);
}
}
First, even the collection contains the instance, the if sentence still return false.
Second, I delete the if sentence, just make the collection can remove the instance. And after the execution the collection still kept its original items, which still include instance.
Is it the Reference problem, but how to fix it? I just want to remove one item from the ObservableCollection and keep its Observable functionality (which puzzled me here).