Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two lists.

var proxy = new List<string>(); // 4 proxies
var urls = new List<string>(); // 100 urls

I want that every proxy make 25 requests with urls. How separate it equality between threads?

What I have tried:

I try use Partitioner.Create, but cannot understand how separate it equality

C#
var proxy = new List<string>();
           var urls = new List<string>();
           Parallel.ForEach(Partitioner.Create(0, urls.Count, urls.Count/proxy.Count),new ParallelOptions{MaxDegreeOfParallelism = 10},range =>
           {
               for (int i = range.Item1; i < range.Item2; i++)
               {
                   ....
               }
           });
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900