Answer the question
In order to leave comments, you need to log in
C#. What is better to use to execute a function in 10 threads?
Hello!
What is better to use to execute a function in 10 threads?
In general, there are 7000 lines, for each of these lines it is necessary to execute the function roughly speaking CheckThis (string request)
I want to speed up this business so that 10 requests are executed at once.
What is better to use for this? Parallels.Foreach? threads? Plinq?
Thanks in advance.
PS If it's not difficult, tell me a mini example. Thanks
Answer the question
In order to leave comments, you need to log in
Parallel.For(0, 1000, new ParallelOptions { MaxDegreeOfParallelism = 10 },
i =>
{
GetPage(pageList[i]);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question