Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }