public void RunDownloadSync() { List <string> websites = Ultility.PrepData(); foreach (var site in websites) { WebsiteDataModel result = Ultility.DownloadWebsite(site); result.Report(); } }
public string RunDownloadSync() { List <string> websites = Ultility.PrepData(); foreach (var site in websites) { WebsiteDataModel result = Ultility.DownloadWebsite(site); result.Report(); } return($"RunDownloadSync - Done - Thread {Thread.CurrentThread.ManagedThreadId}"); }
public static WebsiteDataModel DownloadWebsite(string websiteURL) { WebsiteDataModel output = new WebsiteDataModel(); WebClient client = new WebClient(); output.WebsiteUrl = websiteURL; output.WebsiteData = client.DownloadString(websiteURL); Console.WriteLine($"Getting {websiteURL} - Thread {Thread.CurrentThread.ManagedThreadId}"); return(output); }
public string RunDownload() { List <string> websites = Ultility.PrepData(); foreach (var site in websites) { WebsiteDataModel result = new WebsiteDataModel(); Thread thread = new Thread(() => { result = Ultility.DownloadWebsite(site); }); thread.Start(); //thread.Join(); result.Report(); } return($"RunDownloadSync - Done - Thread {Thread.CurrentThread.ManagedThreadId}"); }