引言
System.Threading.Channels 是.NET Core 3.0 后推出的新的集合类型, 具有异步API,高性能,线程安全等特点,它提供一个异步数据集合,可用于生产者和消费者之前的数据异步传递。
它提供如下方法:
BoundedChannelOptions | Provides options that control the behavior of bounded Channel<T> instances. 提供通道的行为控制 有限通道 |
Channel | Provides static methods for creating channels. 提供创建通道的静态方法 |
Channel<T> | Provides a base class for channels that support reading and writing elements of type 泛型通道,写入和读取方类型都为 T |
Channel<TWrite,TRead> | Provides a base class for channels that support reading elements of type 泛型通道,分别指定写入和读取方的类型 |
ChannelClosedException | Exception thrown when a channel is used after it's been closed. 通道在关闭后被调用时会抛出此异常 |
ChannelOptions | Provides options that control the behavior of channel instances. 提供通道的行为控制 |
ChannelReader<T> | Provides a base class for reading from a channel. 通道读取方的基类 |
ChannelWriter<T> | Provides a base class for writing to a channel. 通道写入方的基类 |
UnboundedChannelOptions | Provides options that control the behavior of unbounded Channel 提供通道的行为控制 无限制通道 |
BoundedChannelFullMode | Specifies the behavior to use when writing to a bounded channel that is already full. 当通道容量达到最大时 控制通道的写入规则 有限通道 |