When I remove items from a collection, what’s happening from the .net side ?
Is a reference to the remove item still valid ?
class myObject
{
int i = 1;
}
...
public ObservableCollection<myObject> myObjects = new ObservableCollection<myObject>();
...
myObjects.Add(new myObject());
myObjects.Add(new myObject());
myObject removedItem = myObjects[1];
myObjects.RemoveAt(1);
// removedItem still valid ?
Yes, it won’t be taken by Garbage Collection, because it is still referenced by another variable in your application.