.NET System.Threading.Channels Primer / Walkthrough
Video Statistics and Information
Channel: Code Evolution
Views: 3,581
Rating: undefined out of 5
Keywords: dotnet, dotnetcore, channels, async, IAsyncEnumerable, producer-consumer, producer consumer
Id: ZPZTa3iLXNY
Channel Id: undefined
Length: 39min 38sec (2378 seconds)
Published: Tue Dec 24 2019
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
Awesome voice. Awesome explanation.
TL;DR:
OP explains with the smoothest voice in tech to come along in ages about the System.Threading.Channels.Channel<T> class. This is an asynchronous Collection that allows asynchronous production and consumption (pub/sub like), part of .net since 1.1. This is the simplest copy paste example in the video (screenshot). The second part is dedicated to using the awesome Open.ChannelExtensions that allow using a fluent/LINQ like interface to asynchronous collections.
I thought I understood async / await fully but I'm missing something at 16:40
The code has
cs await writing; await reading;
I thought
writing
had to finish before it would go on to the next line, so how is it that bothreading
andwriting
are running at the same time?This is a great video. I didn't know about this. I'll need to upgrade my stuff to .NET 3 soon.
A previous video I did related to Channels: https://youtu.be/_P-ikfXiIsU
A great combo:
channel.Reader.ReadAllAsync()
(.NET Core 3.x only) and https://www.nuget.org/packages/System.Linq.Async/If you're using .NET Standard 2.1,
Open.ChannelExtensions
exposes:channel.Reader.AsAsyncEnumerable()