void IRemovableObject.RemoveObject() { if ((source != null) & (target != null)) { source.Remove(target); source = null; target = null; } }
void SetEvents() { Prepare(); if (!(collection is IAddRemove)) { return; } act = (object o) => { Prepare(); }; IAddRemove r = collection as IAddRemove; r.AddAction += act; r.RemoveAction += act; }
void IDisposable.Dispose() { if (isDisposed) { return; } if (!(collection is IAddRemove)) { return; } IAddRemove r = collection as IAddRemove; r.AddAction -= act; r.RemoveAction -= act; isDisposed = true; }