public void AddToQueue(LimitedQueue <T> queue, T value)
        {
            Random rnd   = new Random();
            int    count = rnd.Next(1, 5);

            while (count > 0)
            {
                Task.Factory.StartNew(() =>
                {
                    queue.Enqueue(value);
                }
                                      );
                count--;
            }
        }
        static void Main(string[] args)
        {
            LimitedQueue <int> myQueue = new LimitedQueue <int>(100);

            {
                for (int i = 0; i < 1000; i++)
                {
                    if (i % 3 == 0)
                    {
                        ThreadPool.QueueUserWorkItem((o) => myQueue.Dequeue(), null);
                    }
                    else
                    {
                        ThreadPool.QueueUserWorkItem((o) => myQueue.Enqueue(new Random().Next()), null);
                    }
                }
                Console.ReadLine();
            }
        }