Example #1
0
        Website_VM downloadwebsite(string url)
        {
            WebClient webClient = new WebClient();
            var       obj       = new Website_VM {
                WebSiteUrl = url, WebSiteData = webClient.DownloadString(url)
            };

            return(obj);
        }
Example #2
0
        void RunDownloadSync()
        {
            List <string> Websites = PreData();

            foreach (var item in Websites)
            {
                Website_VM result = downloadwebsite(item);
                ReportWebsiteInfo(result);
            }
        }
Example #3
0
        async Task RunDownload_Async()
        {
            List <string> Websites = PreData();

            foreach (var item in Websites)
            {
                Website_VM result = await Task.Run(() => downloadwebsite(item));

                ReportWebsiteInfo(result);
            }
        }
Example #4
0
 void ReportWebsiteInfo(Website_VM data)
 {
     Console.WriteLine($"{data.WebSiteUrl} , Downloaded: {data.WebSiteData.Length} , Characters Long. {Environment.NewLine}");
 }