The very essence: there is an array of strings, there is a method that takes 1 string and works with it, the result of the method execution can be positive or negative. Purpose: It is necessary to call a method in several threads (with the possibility of restricting threads) (sending an entire new line from the array) for now:
Do not run out of string array
OR
Run successfully n lines. For example, in an array of 100 lines, n = 10, once the method has been successfully completed, we complete the work 10 times.
So far, I was able to implement everything except paragraph 2
CancellationTokenSource cts = new CancellationTokenSource(); var opt = new ParallelOptions { CancellationToken = cts.Token, MaxDegreeOfParallelism = kolthread //ΠΊΠΎΠ»-Π²ΠΎ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΡΡ
ΠΏΠΎΡΠΎΠΊΠΎΠ² }; Parallel.ForEach(lines, opt, a => Metod(a));//lines- ΠΌΠ°ΡΡΠΈΠ² ΡΡΡΠΎΠΊ Can you help implement point 2?
Parallel.ForEach(lines, opt, a => Metod(a));? - Lolidze