RestSharp v。WebClient?
我正在构建Windows Phone 7 Silverlight应用程序。是否有理由使用RestSharp而不是WebClient?我在RestSharp网站上四处浏览,但它的好处并不明显。RestSharp v。WebClient?
RestSharp删除以下痛点:
- 怪癖在.NET的HTTP类(基本认证被破坏,错误处理对于非200的响应,等等)
- 从响应数据自动反序列化到波苏斯
- 简化的API(
request.AddParameter(name, value)
,而不是手动编译请求体) - 简化的请求/响应语义,尤其是异步(但是,它是异步的,并且可能不符合每个人的需求,其中ca本身我也建议评估Hammock)
反序列化可能是因为对于大多数的API,你不必做很多来获取XML或JSON到C#对象的最大涨幅。
我想看看这些网页获取更多信息
https://github.com/restsharp/RestSharp/wiki https://github.com/restsharp/RestSharp/wiki/RestSharp-Blog-Posts-and-Links
随意张贴在这里有任何疑问或对Google Group
这些链接已经死亡。有什么机会可以更新它们? – 2015-01-13 19:47:10
嗨,John,请确认,Windows服务中可以使用Restsharp吗?或WinHttp唯一的选择? – ivorykoder 2016-09-22 13:22:38
读者可以看看RestSharp之间[差异ServiceStack](http://*.com/questions/10117376/)服务栈和用户Runscope API工具的领先者 - restsharp [1]的前任负责人(http://john-sheehan.com/blog/my -net-open-source-project-management-nightmare),[2](http://haacked.com/archiv e/2013/09/18/restsharp-104-2-0-released.aspx) - 就这两个选项给出建议。 – surfmuggle 2013-11-04 20:57:54
该文章http://www.diogonunes.com/blog/webclient-vs-httpclient-vs-httpwebrequest/推荐HttpClient for .Net 4.5+ – 2016-01-24 12:18:16