C# Task Cancellation with Blocking Method Call

Creating and Run a Task

public System.Threading.Tasks.Task StartNew (Action<object?> action, object? state);

Cancel Blocking Task

if (result.AsyncWaitHandle.WaitOne(1000)) 
{
// At this point, asynchronous operation completed
Console.WriteLine("Request processed asyncronously.");
};

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store