I have the task of scanning all folder names using "xyz" in parallel. I meant if one folder receiving the scan at the same time, the other should also receive the scan. I do not want to scan one after another.
For this, I used Parallel Foreach.
Is there a question? Is this right or wrong? and how do you know if it works in parallel (to send a message somewhere)?
Parallel.ForEach(path, currentPath => { var output = programReader.GetData(currentPath, durReader.dirPattern); foreach (var item in output) { foreach (var project in item.Name) Console.WriteLine(item.serverName + " " + item.serverNumber + " " + fileName); } }
EDIT:
Parallel.Foreach only works on multi-core systems or can run on a single-core system also to run show parallelism
source share