private void Dequeue() { if (_head == null) { throw new InvalidOperationException("Can not dequeue from empty queue."); } _head = _head.Next; if (_head == null) { _tail = null; } }
public void Enqueue(Action value) { if (IsEmpty) { _tail = _head = new CleanupAction { Method = value, Next = null }; } else { var item = new CleanupAction { Method = value, Next = null }; _tail.Next = item; _tail = item; } }