设计问题 [英] Design question

查看:102
本文介绍了设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从网络上下载的文件。哪种方式是preferred

I need to download a file from web. Which way is preferred

  1. 的WebRequest / WebResponse类
  2. 在Web客户端

里克

推荐答案

Web客户端更简单,提供了一个的 DownloadFile 应该做你想要的方式。

WebClient is simpler and provides a DownloadFile method that should do what you want.

如果你发现自己在过程中需要更多的控制,你可以切换到使用的WebRequest Web客户端的WebRequest / WebResponse类的包装。

If you find you need more control over the process, you could switch to using WebRequest. WebClient is a wrapper around WebRequest/WebResponse.

这篇关于设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆