Example #1
0
        public string pop()
        {
            Elemento aux = this.topo.Prox;

            if (aux != null)
            {
                this.topo.Prox = aux.Prox;
                aux.Prox       = null;
                if (aux == this.fundo)
                {
                    this.fundo = this.topo;
                }
                return(aux.GetDado());
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Pega o elemento no topo da pilha, removendo-
        /// </summary>
        /// <returns></returns>
        public T Pop()
        {
            Elemento aux = this.topo.Prox;

            if (aux != null)
            {
                this.topo.Prox = aux.Prox;
                aux.Prox       = null;
                if (aux == this.fundo)
                {
                    this.fundo = this.topo;
                }
                this.count--;
                return((T)aux.GetDado());
            }
            else
            {
                return(default(T));
            }
        }