I use the DownloadFileAsync WebClient method to download some files from the server, and I cannot help but notice that in my unofficial testing of my code in VS2010 it blocks for about 3 seconds, this starts, which, in my opinion, hits the target in the first place.
Here is the relevant code snippet:
WebClient downloader = new WebClient(); downloader.DownloadProgressChanged += new DownloadProgressChangedEventHandler(updateDownloadProgress); downloader.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(downloadCompleted); var current_map = map_downloads[0];
I use DownloadFileAsync to block the user interface when the application downloads a 100 MB file. Obviously, if the user interface is blocked for 3 seconds at the start of the call, this reduces the utility, if not completely.
I am relatively inexperienced with C # /. NET (I did a bunch of .Net 2.0, about 3-4 years ago, IIRC, but now I mainly retrain it).
performance c # webclient downloadfileasync
davidtbernal
source share