private static WebsiteDataModel DownloadWebsite(string site) { var output = new WebsiteDataModel(); var client = new WebClient(); output.WebsiteUrl = site; output.WebsiteData = client.DownloadString(site); return(output); }
private static async Task <WebsiteDataModel> DownloadWebsiteAsync(string site) { var output = new WebsiteDataModel(); var client = new WebClient(); output.WebsiteUrl = site; output.WebsiteData = await client.DownloadStringTaskAsync(site); return(output); }
private static void RunDownloadSync() { var websites = PrepareData(); foreach (var site in websites) { WebsiteDataModel results = DownloadWebsite(site); ReportwebsiteInfo(results); } }
private static void ReportwebsiteInfo(WebsiteDataModel data) { WriteLine($"{data.WebsiteUrl} downloaded: {data.WebsiteData.Length} characters long."); }