Esempio n. 1
0
        static void Main(string[] args)
        {
            var queue = new LinkedQueue <int>();

            queue.Enqueue(5);


            var arr = queue.ToArray();

            foreach (var item in arr)
            {
                Console.WriteLine(item);
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            LinkedQueue <string> numbers = new LinkedQueue <string>();

            for (int i = 0; i < 100; i++)
            {
                numbers.Enqueue(i.ToString());
            }

            Console.WriteLine("To array");
            Console.WriteLine(string.Join(", ", numbers.ToArray()));

            Console.WriteLine("Dequeue");

            while (numbers.Count > 0)
            {
                Console.Write(numbers.Dequeue() + (numbers.Count != 0 ? ", " : String.Empty));
            }
            Console.WriteLine();
        }
        public static void Main(string[] args)
        {
            var linkeQueue = new LinkedQueue <int>();

            linkeQueue.Enqueue(1);
            linkeQueue.Enqueue(3);
            linkeQueue.Enqueue(100);
            Console.WriteLine(linkeQueue.Count);
            linkeQueue.Dequeue();
            linkeQueue.Dequeue();
            linkeQueue.Dequeue();
            Console.WriteLine(linkeQueue.Count);

            try
            {
                linkeQueue.Dequeue();
            }
            catch (InvalidOperationException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }

            linkeQueue.Enqueue(1);
            linkeQueue.Enqueue(3);

            while (linkeQueue.Count > 0)
            {
                Console.WriteLine(linkeQueue.Dequeue());
            }

            linkeQueue.Enqueue(1);
            linkeQueue.Enqueue(3);

            var arr = linkeQueue.ToArray();

            Console.WriteLine(string.Join(", ", arr));
        }