Cancelling IAsyncEnumerable in C#

added by DotNetKicks
12/21/2021 9:07:17 PM

440 Views

IAsyncEnumerable combines the power of IEnumerable (which lets us "foreach" through items) with the joys of async code (that we can "await"). Like many async methods, we can pass in a CancellationToken to short-circuit the process. But because of the way that we use IAsyncEnumerable, passing in a cancellation token is a bit different that we are used to.


0 comments