Forum Xamarin.Android

How to cancel an ExecuteAsync?

Im like using restSharp and i have this

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

And after 10 seconds trying i need to stop it so i made a timer but i dont know how to stop it from trying to get the response

Here is something

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

// async with deserialization
var asyncHandle = client.ExecuteAsync<Person>(request, response => {
    Console.WriteLine(response.Data.Name);
});

// abort the request on demand
asyncHandle.Abort();

How can i cancel that?

Sign In or Register to comment.