System.Threading.Channels 9.0.0

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,829
HotChocolate.Execution
Package Description
9,087
HotChocolate.Subscriptions.InMemory
Contains an in-memory implementation for a Hot Chocolate GraphQL subscription provider.
247
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
59
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
61
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
62
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
66
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
71
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
72
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
78
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
80
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
81
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
86
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
94
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
170
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
1,585
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
6,066
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
10,625
Npgsql
Npgsql is the open source .NET data provider for PostgreSQL.
14,286

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 4 11/22/2024
9.0.0-rc.2.24473.5 10 10/12/2024
9.0.0-rc.1.24431.7 8 09/11/2024
9.0.0-preview.7.24405.7 10 08/14/2024
9.0.0-preview.6.24327.7 12 07/17/2024
9.0.0-preview.5.24306.7 9 06/13/2024
9.0.0-preview.4.24266.19 11 05/22/2024
9.0.0-preview.3.24172.9 12 04/19/2024
9.0.0-preview.2.24128.5 12 03/13/2024
9.0.0-preview.1.24080.9 9 02/26/2024
8.0.0 16 11/15/2023
8.0.0-rc.2.23479.6 28 10/17/2023
8.0.0-rc.1.23419.4 19 09/21/2023
8.0.0-preview.7.23375.6 34 08/16/2023
8.0.0-preview.6.23329.7 45 07/11/2023
8.0.0-preview.5.23280.8 36 06/28/2023
8.0.0-preview.4.23259.5 33 06/05/2023
8.0.0-preview.3.23174.8 27 04/15/2023
8.0.0-preview.2.23128.3 36 03/16/2023
8.0.0-preview.1.23110.8 51 02/24/2023
7.0.0 84 01/17/2023
7.0.0-rc.2.22472.3 33 10/16/2022
7.0.0-rc.1.22426.10 30 09/22/2022
7.0.0-preview.7.22375.6 101 08/19/2022
7.0.0-preview.6.22324.4 59 09/17/2022
7.0.0-preview.5.22301.12 31 09/12/2022
7.0.0-preview.4.22229.4 31 10/16/2022
7.0.0-preview.3.22175.4 25 08/29/2022
7.0.0-preview.2.22152.2 44 09/24/2022
7.0.0-preview.1.22076.8 78 09/12/2022
6.0.2-mauipre.1.22102.15 30 09/26/2022
6.0.2-mauipre.1.22054.8 49 09/22/2022
6.0.0 87 09/24/2022
6.0.0-rc.2.21480.5 102 09/12/2022
6.0.0-rc.1.21451.13 96 09/22/2022
6.0.0-preview.7.21377.19 78 09/12/2022
6.0.0-preview.6.21352.12 104 09/12/2022
6.0.0-preview.5.21301.5 93 09/12/2022
6.0.0-preview.4.21253.7 79 09/12/2022
6.0.0-preview.3.21201.4 93 09/12/2022
6.0.0-preview.2.21154.6 52 10/16/2022
6.0.0-preview.1.21102.12 73 09/12/2022
5.0.0 77 09/12/2022
5.0.0-rc.2.20475.5 38 09/12/2022
5.0.0-rc.1.20451.14 33 09/12/2022
5.0.0-preview.8.20407.11 35 09/24/2022
5.0.0-preview.7.20364.11 84 09/12/2022
5.0.0-preview.6.20305.6 99 09/12/2022
5.0.0-preview.5.20278.1 42 09/23/2022
5.0.0-preview.4.20251.6 104 09/12/2022
5.0.0-preview.3.20214.6 88 09/26/2022
5.0.0-preview.2.20160.6 82 09/12/2022
5.0.0-preview.1.20120.5 53 09/12/2022
4.7.1 36 09/12/2022
4.7.0 9,168 09/12/2022
4.7.0-preview3.19551.4 96 09/12/2022
4.7.0-preview2.19523.17 101 09/12/2022
4.7.0-preview1.19504.10 72 09/17/2022
4.6.0 71 09/12/2022
4.6.0-rc1.19456.4 46 10/16/2022
4.6.0-preview9.19421.4 49 09/24/2022
4.6.0-preview9.19416.11 38 09/24/2022
4.6.0-preview8.19405.3 98 09/12/2022
4.6.0-preview7.19362.9 56 09/12/2022
4.6.0-preview6.19303.8 89 09/12/2022
4.6.0-preview6.19264.9 50 09/12/2022
4.6.0-preview5.19224.8 99 09/12/2022
4.6.0-preview4.19212.13 97 09/24/2022
4.6.0-preview3.19128.7 73 09/12/2022
4.6.0-preview.19073.11 85 09/21/2022
4.6.0-preview.18571.3 36 09/12/2022
4.5.0 70 09/12/2022
4.5.0-rc1 50 09/12/2022
4.5.0-preview2-26406-04 64 09/21/2022
4.5.0-preview1-26216-02 54 09/12/2022