Exemple #1
0
        ///Sets next element from the Last Last, returns element of the former Last.
        public int Pop()
        {
            if (Last == null)
            {
                return(0);
            }
            int result = Last.GetValue();

            Last = Last.GetNext();
            return(result);
        }
Exemple #2
0
        /// Deletes last element, returns its value. If stack is empty, throws exeption.
        public int Pop()
        {
            if (head == null)
            {
                throw new StackNullExeption("Trying to pop an empty stack.");
            }
            int result = head.GetValue();

            head = head.GetNext();
            return(result);
        }