コード例 #1
0
        public static void Main(string[] args)
        {
            var stack = new CustomStack <int>();

            stack.Push(50);
            stack.Push(3);
            stack.Push(56);
            stack.Push(50);
            stack.Push(3);
            stack.Push(56);
            stack.Push(50);
            stack.Push(3);
            stack.Push(56);
            stack.Push(50);
            stack.Push(3);
            stack.Push(56);

            Console.WriteLine(stack.Peek());
            stack.Pop();
            var a = stack.Pop();

            Console.WriteLine(a);

            Console.WriteLine(stack.Contains(56));
        }
コード例 #2
0
        private static void Main()
        {
            var stack = new CustomStack <int>();

            for (int i = 0; i < 8; i++)
            {
                stack.Push(i);
            }

            Console.WriteLine(stack);
            Console.WriteLine("Count: {0}", stack.Count);

            stack.Push(100);
            Console.WriteLine(stack);
            Console.WriteLine("Count: {0}", stack.Count);

            Console.WriteLine(stack.Peek());

            stack.Pop();
            Console.WriteLine(stack);
            Console.WriteLine("Count: {0}", stack.Count);
        }