static void Main() { WebDownloader mainGooglePage = new WebDownloader("http://google.com"); ProcessDownload(mainGooglePage); mainGooglePage = new WebDownloader("http://abvgde.tutu"); ProcessDownload(mainGooglePage); Console.ReadKey(); }
private static async void ProcessDownload(WebDownloader webDownloader) { string downloadedContent = await webDownloader.RetrieveContentAsync(); // NOTE: Дальнейшая обработка результата, полученного асинхронно if (webDownloader.LastError != null) { Console.WriteLine("Error: {0}", webDownloader.LastError.Message); } else { Console.WriteLine("Content from {0}", webDownloader.Url); } }