Skip to main content

Chapter 8: Asynchronous streams and resource management

In this chapter

  • The producer/consumer pattern: System.Threading.Channels
    • Creating a channel
    • Handling urgent work: prioritized channels (.NET 9)
  • Consuming asynchronous streams: await foreach
  • Producing asynchronous streams: yield return
  • IAsyncEnumerable<T> and LINQ
  • Adding cancellation support to asynchronous streams
  • Asynchronous resource management: IAsyncDisposable and await using
    • Implementing IAsyncDisposable
    • Should I implement both IDisposable and IAsyncDisposable?
  • Conclusion

This chapter is not available in the free preview. Purchase the book to read the complete edition now.

Buy this book