Пример #1
0
        public object Dequeue()
        {
            if (first == null)
            {
                throw new EmptyQueueException("The Queue is empty");
            }
            Node temp = first;

            first = first.GetNext();
            size--;
            return(temp.GetData());
        }
Пример #2
0
        public object Pop()
        {
            object currentTop;

            if (IsEmpty())
            {
                throw new EmptyStackException("The Stack is empty");
            }
            else
            {
                currentTop = top.GetData();
                top        = top.GetNext();
            }
            return(currentTop);
        }