I am having a task of scanning all the folders name start with "xyz" parallely. I meant if one folder getting scan same time other one should also getting scan. I don't want one by one scanning.
For that I used Parallel Foreach.
Question is? Is it correct or not? and How to know is it running parallely(to put any message some where)?
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:
Is Parallel.Foreach only works on multicore systems or it could work on single core system also to perform show parallelism