AsyncEnumerableSource 1.1.0

dotnet add package AsyncEnumerableSource --version 1.1.0
                    
NuGet\Install-Package AsyncEnumerableSource -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AsyncEnumerableSource" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsyncEnumerableSource" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AsyncEnumerableSource" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AsyncEnumerableSource --version 1.1.0
                    
#r "nuget: AsyncEnumerableSource, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=AsyncEnumerableSource&version=1.1.0
                    
Install AsyncEnumerableSource as a Cake Addin
#tool nuget:?package=AsyncEnumerableSource&version=1.1.0
                    
Install AsyncEnumerableSource as a Cake Tool

AsyncEnumerableSource

.NET language OS GitHub last commit

Overview

AsyncEnumerableSource<T> is a high-performance, thread-safe asynchronous enumerable source designed to facilitate multiple consumers of a data stream. This implementation leverages System.Threading.Channels to efficiently handle asynchronous data production and consumption.

Features

  • Supports multiple consumers subscribing to an asynchronous data stream.
  • Provides methods for safely yielding items to all consumers.
  • Supports completion and faulting of the data stream.
  • Thread-safe implementation with ReaderWriterLockSlim and Interlocked.
  • Optimized for scalability with parallel processing when necessary.

Installation

dotnet add package AsyncEnumerableSource

Usage

Creating an Async Enumerable Source

var source = new AsyncEnumerableSource<T>();

Consuming Data Asynchronously

await foreach (var item in source.GetAsyncEnumerable())
{
    Console.WriteLine(item);
}

Producing Data

source.YieldReturn(value)

Completing the Source

source.Complete();

Handling Errors

If an exception occurs and should propagate to all consumers:

source.Fault(new Exception());

Benchmarks

Benchmarks are included using BenchmarkDotNet. Results can be found in the artifacts of the GitHub Actions runs. To run the benchmarks yourself, run the following command:

dotnet run -c Release --project AsyncEnumerableSource.Benchmarks

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please submit issues and pull requests as needed.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 183 3/7/2025
1.0.4 183 3/7/2025
1.0.3 184 3/7/2025
1.0.2 177 3/7/2025
1.0.1 178 3/6/2025
1.0.0 171 3/6/2025
0.0.1 174 3/6/2025