Effective thread Synchronization in C#
- by n0vic3c0d3r
I have a scenario where I need to search from many binary files (using keys) and combine the results (strings). Until now, I have been doing it in a for loop one file after the other.
foreach (string file in FileSources.Keys)
{
aggregatedDefinitions.Append(DefinitionLookup(txtSearchWord.Text, file));
}
Since this operation is very slow, I was thinking of using threads, so that I could do IO operations in parallel. Is threading the right way to go. If I use threading, how can I ensure that I get the results in the order I want.
I haven't used Threading until now. It would be very helpful if you could suggest some materials/books that would help me solve my problem.