private static async Task <WebSiteDataModel> DownloadAsync(string url) { WebSiteDataModel webSite = null; using (var client = new WebClient()) { webSite = new WebSiteDataModel(); webSite.WebSiteUrl = url; webSite.WebSiteData = await Task.Run(() => client.DownloadString(url)); } return(webSite); }
private static async Task <WebSiteDataModel> DownloadParallelAsync(string url) { WebSiteDataModel webSite = null; using (var client = new WebClient()) { webSite = new WebSiteDataModel(); webSite.WebSiteUrl = url; webSite.WebSiteData = await client.DownloadStringTaskAsync(url); } return(webSite); }
private static WebSiteDataModel Download(string url) { WebSiteDataModel webSite = null; using (var client = new WebClient()) { webSite = new WebSiteDataModel(); webSite.WebSiteUrl = url; webSite.WebSiteData = client.DownloadString(url); } return(webSite); }