예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello simple stack!");
            var stack = new SimpleStack <string>(10);

            stack.Push("Winter");
            stack.Push("Spring");
            stack.Push("Summer");
            stack.Push("Autumn");

            Console.WriteLine("1. Stack after Push (x4) :");
            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }

            Debug.WriteLine(stack.Pop());
            Debug.WriteLine(stack.Pop());

            Console.WriteLine("2. Stack after Pop (x2) :");
            foreach (var item in stack)
            {
                Console.WriteLine(item);
            }
        }
예제 #2
0
 public SimpleStackEnumerator(SimpleStack <T> stack)
 {
     _stack = stack ?? throw new ArgumentNullException(nameof(stack));
 }