小编Rob*_*arb的帖子

C#WebClient DownloadProgressChanged将无法正常工作

我正在尝试使用WebClient对象的DownloadDataAsync方法使用C#从Internet下载文件.

我还想通过使用webclient对象的DownloadProgressChanged事件来获取下载进度.

问题是,BytesReceived和TotalBytesToReceive属性都没有显示正确的值.当我在调试时尝试检查它们时,它们都以不可复制的方式发生变化.

我的代码:

WebClient client = new WebClient();
        client.BaseAddress = this.DownloadUrl;
        client.DownloadProgressChanged += downloadProgressDelegate;
        client.DownloadDataAsync(new System.Uri(this.DownloadUrl));
Run Code Online (Sandbox Code Playgroud)

.net c# webclient file download

6
推荐指数
1
解决办法
3741
查看次数

标签 统计

.net ×1

c# ×1

download ×1

file ×1

webclient ×1