I have a List<string> containing 50K to 100K words
I would like to iterate through it in a parallel and asynchronous fashion
As an example, I could use
while (true)
{
Parallel.ForEach(words, new ParallelOptions { MaxDegreeOfParallelism = 100 }, ...)
}
But problems are:
Parallel.ForEachisn't asynchronous- When we arrive at the end of the list, we have to wait for each thread to end before the
while (true)statement continues - Which means that there aren't always 100 threads running, which is what I want
How would I be able to achieve this?
Please let me know if this is confusing, or if I'm bad at explaining things.