Ejemplo n.º 1
0
        static void Main()
        {
            var testCustomStack = new CustomStack <int>();

            for (int i = 0; i < 10; i++)
            {
                testCustomStack.Push(i + 1);
            }

            Console.WriteLine("Stack size: {0}", testCustomStack.Count);

            while (testCustomStack.Count > 0)
            {
                Console.WriteLine("Stack current top element: {0}", testCustomStack.Pop());
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            CustomStack <int> stack = new CustomStack <int>();

            stack.Push(4);
            stack.Push(5);
            stack.Push(6);
            stack.Push(7);

            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine(stack.Contains(7));

            Console.WriteLine();

            while (stack.Count > 0)
            {
                Console.WriteLine(stack.Pop());
            }
        }