Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# RestSharp执行同步,而不是异步_C#_Httpwebrequest_Restsharp - Fatal编程技术网

C# 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小组中询问过,他们说这是因为使用

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

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

// 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);
});