2012-12-05 142 views
4

有沒有辦法同步使用restsharp?我在Visual Studio中看到每一種方法都有了「異步」後綴和restsharp主頁,(至極具有下面的例子):RestSharp執行同步,而不是異步

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

顯然使得同步和異步請求之間的distiction:

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

如何訪問此「執行」同步方法?

+0

我安裝了Restharp並且無法訪問「Execute」方法,有什麼想法? –

回答

4

我在他們的googlegroups問他們說,這是因爲使用wp7時的「platorm限制」。非常整潔的權利?

+0

異步是在任何情況下最好的方式。他們不提供同步方法,因爲他們不希望人們構建不響應的應用程序。 –

+0

我認爲在回調後嵌套回調可能會更好。 –