public void Push(T item) { _impl.Add(item); if (ItemPushed != null) { ItemPushed.Invoke(this, new StackItemEventArgs <T>(item)); } }
public bool Push() { if (_enumerator.MoveNext()) { ItemPushed?.Invoke(this, new ItemPushedEventArgs <T>(_enumerator.Current)); return(true); } else { AreAllItemsPushed = true; AllItemsPushed?.Invoke(this, EventArgs.Empty); AllItemsPushed = null; return(false); } }
public void Push(T newObj) { Item <T> nextItem = GetNextEmptyItem(); if (nextItem != null) { nextItem.Object = newObj; nextItem.IsFilled = true; _Head = nextItem; } else { _CapacityHead = _Head = new Item <T>(_Head, newObj); } ItemPushed?.Invoke(this, newObj, _Head.Index); }