c# - RestSharp 执行同步,而不是异步

标签 c# httpwebrequest restsharp

有没有办法同步使用restsharp?我在 Visual Studio 中看到的每个方法都有“异步”后缀和 restsharp 主页(其中有以下示例):

// execute the request
RestResponse response = client.Execute(request);
var content = response.Content; // raw content as string

明确区分同步请求和异步请求:

// easy async support
client.ExecuteAsync(request, response => {
    Console.WriteLine(response.Content);
});

如何访问此“执行”同步方法?

最佳答案

我在他们的 googlegroups 中询问,他们说这是因为使用 wp7 时存在“平台限制”。很整洁吧?

关于c# - RestSharp 执行同步,而不是异步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13731691/

相关文章:

c# - 在 Where Linq 语句中使用具有泛型类型的 == 运算符

tcp - HttpWebRequest - 重用 TCP 连接

c# - Postman http请求成功,C# HttpWebRequest错误 SSL/TLS安全通道的信任关系

http - 有没有办法允许 Google App Engine 通过 DELETE 请求发送正文或有效负载?

c# - 如何忽略 JSON 响应的最外层?

c# - 如何(垂直)放置不同高度的 WrapPanel 项目?

播放 .wav 时的 C# 消息队列

c# - 使用 HttpGET 的 RestSharp 方法 AddParameter 和 AddQueryParameter 之间的区别

c# - Flask 服务器 - C# 客户端 - 发布图片

c# - 程序集 'SomeAssembly, uses ' System.Web.Mvc,Version=4.0.0.0,其版本高于引用的程序集 'System.Web.Mvc,Version 3.0.0.0