Quantcast
Viewing all articles
Browse latest Browse all 32057

how to increase parallel for each loop

 List<string> aa = new List<string>();

            aa.Add("aa");
           
          
          
            int count = 0;
            Parallel.ForEach(aa, new ParallelOptions { MaxDegreeOfParallelism = 1 }, bb =>
            {
              
           
                Console.WriteLine("value:" + bb);
                
                    
                    aa.Add("asasasa");

                
                Thread.Sleep(10);
                
             
            }
            );

here only one loop of parallel.foreach run but i have added value in list "aa"  so it should go to infinite loop but it is not behaving like that

Viewing all articles
Browse latest Browse all 32057

Trending Articles