public TValue Dequeue() { if (head == null) { throw new InvalidOperationException(); } var result = head.Value; head = head.Next; if (head == null) { tail = null; } return(result); }
public void Enqueue(TValue value) { var item = new QueueItemGeneric <TValue> { Value = value }; if (head == null) { head = tail = item; } else { tail.Next = item; tail = item; } }