Click here to Skip to main content
15,920,576 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a List populated with filenames. I would like to write in those file with same content. I want this to be happen parallel. Once a file is written, i want to remove the filename from the List. There is more than 1000 of files to write. Can i Use TPL in this scenario. How should i implement TPL here?

Thanks,
Amrutha.
Posted

1 solution

Try something like this:
String text = ...;
FilenameList.AsParallel().ForAll(filename => 
{
  // write text to filename
}

No need to remove filenames from the list because they are all processed once.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900