I\'m struggling to find a modern example of some asynchronous C# code that uses RestSharp with async
and await
. I know there\'s been a recent updat
In my case, I had to call Task.Wait() for it to work properly. However, I used the version which does not take CancellationTokenSource as parameter.
private static async void Main()
{
var client = new RestClient();
var request = new RestRequest("http://www.google.com");
Task t = client.ExecuteTaskAsync(request);
t.Wait();
var restResponse = await t;
Console.WriteLine(restResponse.Content); // Will output the HTML contents of the requested page
}