System.Threading.Channels 9.0.4

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,869
HotChocolate.Execution
Package Description
9,313
HotChocolate.Subscriptions.InMemory
Contains an in-memory implementation for a Hot Chocolate GraphQL subscription provider.
254
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
69
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
72
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
76
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
77
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
78
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
85
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
89
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
93
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
99
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
110
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
177
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
1,592
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
6,299
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
10,821
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
14,446

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
10.0.0-preview.3.25171.5 8 04/13/2025
10.0.0-preview.2.25163.2 10 03/21/2025
10.0.0-preview.1.25080.5 10 02/27/2025
9.0.4 4 04/11/2025
9.0.3 9 03/16/2025
9.0.2 8 02/27/2025
9.0.1 8 01/23/2025
9.0.0 13 11/22/2024
9.0.0-rc.2.24473.5 19 10/12/2024
9.0.0-rc.1.24431.7 17 09/11/2024
9.0.0-preview.7.24405.7 28 08/14/2024
9.0.0-preview.6.24327.7 19 07/17/2024
9.0.0-preview.5.24306.7 16 06/13/2024
9.0.0-preview.4.24266.19 18 05/22/2024
9.0.0-preview.3.24172.9 25 04/19/2024
9.0.0-preview.2.24128.5 23 03/13/2024
9.0.0-preview.1.24080.9 18 02/26/2024
8.0.0 22 11/15/2023
8.0.0-rc.2.23479.6 37 10/17/2023
8.0.0-rc.1.23419.4 34 09/21/2023
8.0.0-preview.7.23375.6 43 08/16/2023
8.0.0-preview.6.23329.7 56 07/11/2023
8.0.0-preview.5.23280.8 49 06/28/2023
8.0.0-preview.4.23259.5 41 06/05/2023
8.0.0-preview.3.23174.8 34 04/15/2023
8.0.0-preview.2.23128.3 49 03/16/2023
8.0.0-preview.1.23110.8 59 02/24/2023
7.0.0 95 01/17/2023
7.0.0-rc.2.22472.3 42 10/16/2022
7.0.0-rc.1.22426.10 47 09/22/2022
7.0.0-preview.7.22375.6 119 08/19/2022
7.0.0-preview.6.22324.4 70 09/17/2022
7.0.0-preview.5.22301.12 46 09/12/2022
7.0.0-preview.4.22229.4 46 10/16/2022
7.0.0-preview.3.22175.4 41 08/29/2022
7.0.0-preview.2.22152.2 60 09/24/2022
7.0.0-preview.1.22076.8 90 09/12/2022
6.0.2-mauipre.1.22102.15 39 09/26/2022
6.0.2-mauipre.1.22054.8 60 09/22/2022
6.0.0 96 09/24/2022
6.0.0-rc.2.21480.5 112 09/12/2022
6.0.0-rc.1.21451.13 104 09/22/2022
6.0.0-preview.7.21377.19 92 09/12/2022
6.0.0-preview.6.21352.12 121 09/12/2022
6.0.0-preview.5.21301.5 107 09/12/2022
6.0.0-preview.4.21253.7 98 09/12/2022
6.0.0-preview.3.21201.4 104 09/12/2022
6.0.0-preview.2.21154.6 61 10/16/2022
6.0.0-preview.1.21102.12 87 09/12/2022
5.0.0 92 09/12/2022
5.0.0-rc.2.20475.5 48 09/12/2022
5.0.0-rc.1.20451.14 43 09/12/2022
5.0.0-preview.8.20407.11 45 09/24/2022
5.0.0-preview.7.20364.11 92 09/12/2022
5.0.0-preview.6.20305.6 119 09/12/2022
5.0.0-preview.5.20278.1 53 09/23/2022
5.0.0-preview.4.20251.6 117 09/12/2022
5.0.0-preview.3.20214.6 102 09/26/2022
5.0.0-preview.2.20160.6 91 09/12/2022
5.0.0-preview.1.20120.5 64 09/12/2022
4.7.1 44 09/12/2022
4.7.0 9,403 09/12/2022
4.7.0-preview3.19551.4 106 09/12/2022
4.7.0-preview2.19523.17 123 09/12/2022
4.7.0-preview1.19504.10 88 09/17/2022
4.6.0 85 09/12/2022
4.6.0-rc1.19456.4 58 10/16/2022
4.6.0-preview9.19421.4 56 09/24/2022
4.6.0-preview9.19416.11 46 09/24/2022
4.6.0-preview8.19405.3 113 09/12/2022
4.6.0-preview7.19362.9 63 09/12/2022
4.6.0-preview6.19303.8 99 09/12/2022
4.6.0-preview6.19264.9 61 09/12/2022
4.6.0-preview5.19224.8 109 09/12/2022
4.6.0-preview4.19212.13 108 09/24/2022
4.6.0-preview3.19128.7 94 09/12/2022
4.6.0-preview.19073.11 95 09/21/2022
4.6.0-preview.18571.3 45 09/12/2022
4.5.0 85 09/12/2022
4.5.0-rc1 66 09/12/2022
4.5.0-preview2-26406-04 75 09/21/2022
4.5.0-preview1-26216-02 64 09/12/2022