/// <inheritdoc /> public void RemoveAt(int index) { var item = this[index]; RemovingItem?.Invoke(item); ListAction(x => x.RemoveAt(index)); RemovedItem?.Invoke(item); }
/// <inheritdoc /> public bool Remove(T item) { RemovingItem?.Invoke(item); var removed = ListFunc(x => x.Remove(item)); RemovedItem?.Invoke(item); return(removed); }
public override void Remove(ListViewItem item) { if (!noEvents) { RemovingItem?.Invoke(this, item); } base.Remove(item); if (!noEvents) { RemovedItem?.Invoke(this, item); } }
/// <summary> /// Clears the Bidirectional List of its Items. This operation is a bit expensive /// because a local collection must be maintained in order to properly connect the /// callback methods. /// </summary> /// <inheritdoc /> public void Clear() { // We need to maintain a Local Collection for this one. var clearing = new List <T>(Collection); void ReportClearing(BidirectionalListItemCallback <T> callback) { foreach (var x in clearing) { callback.Invoke(x); } } ReportClearing(x => RemovingItem?.Invoke(x)); ListAction(x => x.Clear()); ReportClearing(x => RemovedItem?.Invoke(x)); }