WebClient和HttpClient 的区别对比
| 可用于 .NET之前的旧版本,如2.0 | .NET 4.0 以上. Created to support the growing need of the Web API REST calls |
| WinRT applications cannot use WebClient | HttpClient can be used with WinRT |
| Provides progress reporting for downloads. | No progress reporting for downloads. |
| Does not reuse resolved DNS, configured-cookies. | Can resuse resolved DNS, cookie configuration and other authentication. |
| You need to new up a WebClient to make concurrent request. | Single HttpClient can make concurrent requests. |
| Thin layer over WebRequest and WebResponse | Thin layer over HttpWebRequest and HttpWebResponse |
| Mocking and testing WebClient is difficult | Mocking and testing HttpClient is easy |
| 支持 FTP. | 不支持 FTP. |
| Both synchronous and Asynchronous methods are available for IO bound requests. | All IO bound methods in HTTPClient are asynchronous. |