C# RestSharp执行同步,而不是异步
有没有同步使用restsharp的方法?我在Visual Studio中看到的每个方法都有“async”后缀和restsharp主页(其中有以下示例): 明确区分同步和异步请求:C# RestSharp执行同步,而不是异步,c#,httpwebrequest,restsharp,C#,Httpwebrequest,Restsharp,有没有同步使用restsharp的方法?我在Visual Studio中看到的每个方法都有“async”后缀和restsharp主页(其中有以下示例): 明确区分同步和异步请求: // easy async support client.ExecuteAsync(request, response => { Console.WriteLine(response.Content); }); 我怎样才能访问这个“执行”同步方法呢?我在他们的Google小组中询问过,他们说这是因为使用
// easy async support
client.ExecuteAsync(request, response => {
Console.WriteLine(response.Content);
});
我怎样才能访问这个“执行”同步方法呢?我在他们的Google小组中询问过,他们说这是因为使用wp7时的“柏拉图限制”。非常整洁,对吗?我安装了Restsharp,无法访问“Execute”方法,有什么想法吗?在任何情况下,异步都是最好的方法。他们不提供同步方法,因为他们不希望人们构建无响应的应用程序。我认为在回调之后嵌套回调可能更好。
// easy async support
client.ExecuteAsync(request, response => {
Console.WriteLine(response.Content);
});