Ejemplo n.º 1
0
        /// <summary>
        /// Push the items from a stack onto a stack.
        /// </summary>
        /// <param name="Stack"></param>
        public void Push(ExStack <T> Stack)
        {
            // reverse the incoming stack
            Stack.Reverse();

            // pop the incoming stack and push on to this stack
            for (int i = 0; i < Stack.Count; i++)
            {
                Push(Stack.Pop());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Pops the items from the stack and places them in their own stack
        /// </summary>
        /// <param name="PopCount"></param>
        /// <returns></returns>
        public ExStack <T> PopStack(int PopCount)
        {
            // create a new stack
            ExStack <T> stack = new ExStack <T>(PopCount);

            for (int i = 0; i < PopCount; i++)
            {
                stack.Push(this.Pop());
            }

            stack.Reverse();

            return(stack);
        }