public static void Read()
 {
     for (int i = 0; i < 8; i++)
     {
         Console.WriteLine("Producer reading...");
         int result = ar.Dequeue();
         Console.WriteLine("Consumer read: " + result);
     }
 }
 private void UploadMaterial()
 {
     for (int i = 0; i < _productsCount; i++)
     {
         if (_cancelToken.IsCancellationRequested)
         {
             return;
         }
         _products.Add(_afterMakingPack.Dequeue());
     }
 }
        private void AssemblyProduct(object cancelToken)
        {
            while (true)
            {
                //int threadIndex = (int)threadContext;
                //Console.WriteLine("thread Pack {0} started...", threadIndex);

                if (_cancelToken.IsCancellationRequested)
                {
                    return;
                }

                HardWork();// имитация сложной работы
                var product = _input.Dequeue();

                Make(product);

                PrintInformationAboutAssemblyShop(product.ToProductInfo());
                //Console.WriteLine("thread Pack {0} result calculated productId {1}...", threadIndex, product.Id);
                _output.Enqueue(product);
            }
        }