Search code examples
c#.netperformancedownloadwebclient

Fastest way to download multiple webpages using C#


This is a (basic) example of what I currently have:

foreach (var uri in uris)
{
    using (var client = new WebClient())
    {
        client.Proxy = null;
        client.DownloadStringCompleted += DownloadComplete;
        client.DownloadStringAsync(uri);
    }
}

Is there a faster way?


Solution

  • The important thing is to make the downloads in parallel, which you are already doing thanks to the Async download.

    The download speed of your code is entirely dependent of the actual network transfer speed, so it is as good as it gets.