public void Enqueue(T data) { var node = new MyLinkedListQueueNode <T>(data); if (_head == null) { _tail = _head = node; } else { _head.Next = node; _head = node; } Count++; }
public T Dequeue() { if (_tail == null) { throw new InvalidOperationException(); } var data = _tail.Data; _tail = _tail.Next; Count--; if (_tail == null) { _head = null; } return(data); }