
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QueueSimple2
{
    class Program
    {
        static void Main(string[] args)
        {
            var q = new Queue<int>();
            q.Enqueue(10);
            q.Enqueue(20);
            Console.WriteLine("myQ");
            Console.WriteLine("\tCount:    {0}", q.Count);
            Console.Write("\tValues:");
            PrintValues(q); //Display
            int[] data = q.ToArray(); // Exports to an array
            Console.WriteLine("data[1]"+data[1]); // 20
 
            Console.WriteLine(q.Count); // 2
            Console.WriteLine(q.Peek()); // 10
            Console.WriteLine(q.Dequeue()); // 10
            Console.WriteLine(q.Dequeue()); // 20
            Console.WriteLine(q.Dequeue()); // throws an exception (queue empty)
            Console.ReadKey();
        }
        public static void PrintValues(IEnumerable<int> myCollection)
        {
            foreach (int obj in myCollection)
                Console.Write("    {0}", obj);
            Console.WriteLine();
        }
    }
}
