c# - DownloadStringAsync doesn't return complete string -


i download bunch of strings different addresses , need download them quick possible. use 10 downloadstringasync , 1 downloadstring.

simplified code looks this:

    ...     foreach(...)     {         using (webclient client = new webclient())         {             if (asyncworkers < 10)             {                 client.downloadstringcompleted += done;                 client.downloadstringasync(uri);                 asyncworkers++;             }else{                 string data = client.downloadstring(uri);                 processdata(data);             }         }     }     ...   private void done(...) {     processdata(e.result);     asyncworkers--; } 

the issue time time e.result in done not complete. when use either downloadstring or downloadstringasync allways complete. normal , shall redownload when isn't complete or way wrote wrong? , in case wrong how force wait untill 1 of 10 downloadstringasync finishes work? thanks.


Comments