I have code with a parallel class for loading pages from the Internet. Since I load about 3,000 pages, I want to know if this is the best way.
Parallel.For(0, 3000, i =>
{
Console.WriteLine(i.ToString());
//HttpDownloader is my class for downloading
HttpDownloader ht = new HttpDownloader(s[i]);
string a = ht.GetPage();
Console.WriteLine(i.ToString());
});
After that I run 2 func: pharsing (string html) and save () // Save to DB How can I do this in Parallel ?? And, if I want it to start the background, do I need to paste it into BackgroundWorker?
source
share