Strona głównaSztuka programowania

In this post I discuss the new Task.WaitAsync() APIs introduced in .NET 6, how you can use them to "cancel" an await call, and how they can replace other approaches you may be using currently.The new Task.WaitAsync API in .NET 6 In a recent post, I described how to use a TaskCompletionSource with IHostApplicationLifetime as a way of "pausing" a background service until the application starts up. In that code I used the following function that waits for a TaskCompletionSource.Task to complete, but also s...

Tagi: async/await
Źródło: andrewlock.net
Dziel się z innymi:
Cancelling await calls in .NET 6 with Task.WaitAsync()
Wczytywanie artykułów...

Najaktywniejsi w tym miesiącu