System.Threading.Channels 9.0.0-preview.3.24172.9

About

The System.Threading.Channels library provides types for passing data asynchronously between producers and consumers.

Key Features

  • Abstractions representing channels for one or more producers to publish data to one or more consumers
  • APIs focused on asynchronous production and consumption of data
  • Factory methods for producing multiple kinds of channels

How to Use

using System;
using System.Threading.Channels;
using System.Threading.Tasks;

Channel<int> channel = Channel.CreateUnbounded<int>();

Task producer = Task.Run(async () =>
{
    int i = 0;
    while (true)
    {
        channel.Writer.TryWrite(i++);
        await Task.Delay(TimeSpan.FromSeconds(1));
    }
});

Task consumer = Task.Run(async () =>
{
    await foreach (int value in channel.Reader.ReadAllAsync())
    {
        Console.WriteLine(value);
    }
});

await Task.WhenAll(producer, consumer);

Main Types

The main types provided by this library are:

  • System.Threading.Channel<T>
  • System.Threading.Channel

Additional Documentation

https://www.nuget.org/packages/System.Threading.Tasks.Dataflow/

Feedback & Contributing

System.Threading.Channels is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Threading.Channels.

Packages Downloads
HotChocolate.Execution
Package Description
1,605
HotChocolate.Execution
Package Description
7,876
HotChocolate.Subscriptions.InMemory
Contains an in-memory implementation for a Hot Chocolate GraphQL subscription provider.
238
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
41
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
44
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
48
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
50
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
52
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
54
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
57
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
59
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
64
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
155
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
1,566
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
4,825
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
9,605
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
13,381

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET Standard 2.0

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
9.0.0-preview.3.24172.9 1 04/19/2024
9.0.0-preview.2.24128.5 3 03/13/2024
9.0.0-preview.1.24080.9 2 02/26/2024
8.0.0 7 11/15/2023
8.0.0-rc.2.23479.6 10 10/17/2023
8.0.0-rc.1.23419.4 7 09/21/2023
8.0.0-preview.7.23375.6 17 08/16/2023
8.0.0-preview.6.23329.7 23 07/11/2023
8.0.0-preview.5.23280.8 19 06/28/2023
8.0.0-preview.4.23259.5 15 06/05/2023
8.0.0-preview.3.23174.8 12 04/15/2023
8.0.0-preview.2.23128.3 14 03/16/2023
8.0.0-preview.1.23110.8 28 02/24/2023
7.0.0 52 01/17/2023
7.0.0-rc.2.22472.3 19 10/16/2022
7.0.0-rc.1.22426.10 14 09/22/2022
7.0.0-preview.7.22375.6 62 08/19/2022
7.0.0-preview.6.22324.4 41 09/17/2022
7.0.0-preview.5.22301.12 19 09/12/2022
7.0.0-preview.4.22229.4 19 10/16/2022
7.0.0-preview.3.22175.4 11 08/29/2022
7.0.0-preview.2.22152.2 24 09/24/2022
7.0.0-preview.1.22076.8 45 09/12/2022
6.0.2-mauipre.1.22102.15 15 09/26/2022
6.0.2-mauipre.1.22054.8 34 09/22/2022
6.0.0 57 09/24/2022
6.0.0-rc.2.21480.5 65 09/12/2022
6.0.0-rc.1.21451.13 59 09/22/2022
6.0.0-preview.7.21377.19 52 09/12/2022
6.0.0-preview.6.21352.12 67 09/12/2022
6.0.0-preview.5.21301.5 56 09/12/2022
6.0.0-preview.4.21253.7 49 09/12/2022
6.0.0-preview.3.21201.4 53 09/12/2022
6.0.0-preview.2.21154.6 40 10/16/2022
6.0.0-preview.1.21102.12 43 09/12/2022
5.0.0 60 09/12/2022
5.0.0-rc.2.20475.5 22 09/12/2022
5.0.0-rc.1.20451.14 24 09/12/2022
5.0.0-preview.8.20407.11 23 09/24/2022
5.0.0-preview.7.20364.11 57 09/12/2022
5.0.0-preview.6.20305.6 66 09/12/2022
5.0.0-preview.5.20278.1 24 09/23/2022
5.0.0-preview.4.20251.6 64 09/12/2022
5.0.0-preview.3.20214.6 51 09/26/2022
5.0.0-preview.2.20160.6 60 09/12/2022
5.0.0-preview.1.20120.5 33 09/12/2022
4.7.1 22 09/12/2022
4.7.0 7,926 09/12/2022
4.7.0-preview3.19551.4 64 09/12/2022
4.7.0-preview2.19523.17 65 09/12/2022
4.7.0-preview1.19504.10 52 09/17/2022
4.6.0 43 09/12/2022
4.6.0-rc1.19456.4 33 10/16/2022
4.6.0-preview9.19421.4 36 09/24/2022
4.6.0-preview9.19416.11 28 09/24/2022
4.6.0-preview8.19405.3 57 09/12/2022
4.6.0-preview7.19362.9 39 09/12/2022
4.6.0-preview6.19303.8 54 09/12/2022
4.6.0-preview6.19264.9 36 09/12/2022
4.6.0-preview5.19224.8 60 09/12/2022
4.6.0-preview4.19212.13 64 09/24/2022
4.6.0-preview3.19128.7 46 09/12/2022
4.6.0-preview.19073.11 54 09/21/2022
4.6.0-preview.18571.3 18 09/12/2022
4.5.0 49 09/12/2022
4.5.0-rc1 30 09/12/2022
4.5.0-preview2-26406-04 38 09/21/2022
4.5.0-preview1-26216-02 35 09/12/2022