using System.Net; using System.Threading.Tasks; namespace Aggregator { public static class Download { /// /// Download source from a given site synchronously /// /// Site to download from /// public static string DownloadXMLSync(string site) { using (var client = new WebClient()) { return client.DownloadString(site); } } /// /// Download source from a given site asynchronously /// /// Site to download from /// public static Task DownloadXML(string site) { using (var client = new WebClient()) { /* TODO: Find some way to circumvent creating a new WebClient every download *2019-02-03 23:43*/ return client.DownloadStringTaskAsync(site); } } } }