public object Dequeue() { if (first == null) { throw new EmptyQueueException("The Queue is empty"); } Node temp = first; first = first.GetNext(); size--; return(temp.GetData()); }
public object Pop() { object currentTop; if (IsEmpty()) { throw new EmptyStackException("The Stack is empty"); } else { currentTop = top.GetData(); top = top.GetNext(); } return(currentTop); }