Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }