There is a site that I parse in multi-thread The main problem is that I do not know in advance the number of pages. Therefore, I want to make a check through the while . How to combine these two designs? Or maybe there is an alternative?

 Parallel.For(0, 10, new ParallelOptions { MaxDegreeOfParallelism = 4 }, count => { Console.WriteLine(count); }); 
  • one
    A little confusing question. What check you want to do through while? - Umed
  • Can you get the number of pages in advance, or new pages come during the analysis of the current? - VladD
  • Parallel can be replaced by Task with the AttachedToParent parameter - see an example here - Stack
  • And if you need to work with a collection from different threads, then use classes from Concurent - see here - Stack

0