diff options
author | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-02 13:49:23 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadevchavali1@gmail.com> | 2019-02-02 13:49:23 +0000 |
commit | 9e5cd91ede18789e43eee4393d4b69e7ae7a46e8 (patch) | |
tree | c8e9d7bc80a24a50eea54aa7dd18e39818b53d24 /Aggregator/Parser/Download.cs | |
parent | 496396683c6fa15f2daf3c27567cbd26b7941e7c (diff) | |
download | newsaggregator-9e5cd91ede18789e43eee4393d4b69e7ae7a46e8.tar.gz newsaggregator-9e5cd91ede18789e43eee4393d4b69e7ae7a46e8.tar.bz2 newsaggregator-9e5cd91ede18789e43eee4393d4b69e7ae7a46e8.zip |
Added function to download asynchronously, useful for server usage
Diffstat (limited to 'Aggregator/Parser/Download.cs')
-rw-r--r-- | Aggregator/Parser/Download.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Aggregator/Parser/Download.cs b/Aggregator/Parser/Download.cs index 30a2881..c90dc0a 100644 --- a/Aggregator/Parser/Download.cs +++ b/Aggregator/Parser/Download.cs @@ -1,11 +1,18 @@ using System.Net; +using System.Threading.Tasks; namespace Parser { public static class Download { - public static string DownloadXML(string site) { + public static string DownloadXMLSync(string site) { using (var client = new WebClient()) { return client.DownloadString(site); } } + + public static Task<string> DownloadXML(string site) { + using (var client = new WebClient()) { + return client.DownloadStringTaskAsync(site); + } + } } } |