我用 webClient.DownloadFile()
下载我可以设置超时这样的文件,以便它不会需要很长时间,如果它不能访问文件?
I'm using webClient.DownloadFile()
to download a file can I set a timeout for this so that it won't take so long if it can't access the file?
尝试 WebClient.DownloadFileAsync()
。您可以拨打 CancelAsync()
在定时器用自己的超时。
Try WebClient.DownloadFileAsync()
. You can call CancelAsync()
by timer with your own timeout.