LinqExtension 1.0.3

dotnet add package LinqExtension --version 1.0.3
                    
NuGet\Install-Package LinqExtension -Version 1.0.3
                    
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="LinqExtension" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LinqExtension" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="LinqExtension" />
                    
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 LinqExtension --version 1.0.3
                    
#r "nuget: LinqExtension, 1.0.3"
                    
#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.
#:package LinqExtension@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LinqExtension&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=LinqExtension&version=1.0.3
                    
Install as a Cake Tool

C# LINQ Async Extensions

This project provides a set of extension methods that enhance the LINQ (Language Integrated Query) functionality in C# by adding support for asynchronous operations. It includes extensions for common LINQ operations such as Select, SelectMany, and Where, allowing developers to work with asynchronous sources and transformations.

ForeachExtensions

The ForeachExtensions class contains extension methods for asynchronous iteration over collections using foreach loops. It includes the following methods:

  • ForEach: Iterates over an enumerable and executes an action synchronously.
  • ForEachAsync: Iterates over an enumerable and executes an asynchronous action.
  • ForEach (for IAsyncEnumerable): Iterates over an async enumerable and executes an action.

ListExtensions

The ListExtensions class provides an extension method for converting an IAsyncEnumerable or Task<IEnumerable> to a List asynchronously. It includes the following method:

  • ToListAsync: Converts an asynchronous enumerable to a list.

SelectExtensions

The SelectExtensions class adds async projection capabilities to the Select operation. It offers various overloads to handle synchronous and asynchronous transform functions. The methods included are:

  • Select (for Task<IEnumerable>): Projects elements asynchronously using a synchronous transform function.
  • Select (for IAsyncEnumerable): Projects elements asynchronously using a synchronous transform function.
  • SelectAsync (for IEnumerable): Projects elements asynchronously using an asynchronous transform function.
  • SelectAsync (for Task<IEnumerable>): Projects elements asynchronously using an asynchronous transform function.
  • SelectAsync (for IAsyncEnumerable): Projects elements asynchronously using an asynchronous transform function.

SelectManyExtensions

The SelectManyExtensions class extends the SelectMany operation with async support. It allows flattening and transforming collections asynchronously using synchronous and asynchronous transform functions. The methods provided are:

  • SelectMany (for Task<IEnumerable>): Flattens and transforms elements asynchronously using a synchronous transform function.
  • SelectManyAsync (for Task<IEnumerable>): Flattens and transforms elements asynchronously using an asynchronous transform function.
  • SelectManyAsync (for IEnumerable): Flattens and transforms elements asynchronously using an asynchronous transform function.
  • SelectManyAsync (for IAsyncEnumerable): Flattens and transforms elements asynchronously using an asynchronous transform function.
  • SelectMany (for IAsyncEnumerable): Flattens and transforms elements asynchronously using a synchronous transform function.

WhereExtensions

The WhereExtensions class adds async filtering capabilities to the Where operation. It allows filtering elements from asynchronous sources based on synchronous and asynchronous conditions. The methods included are:

  • Where (for Task<IEnumerable>): Filters elements asynchronously using a synchronous condition.
  • Where (for IAsyncEnumerable): Filters elements asynchronously using a synchronous condition.
  • WhereAsync (for IEnumerable): Filters elements asynchronously using an asynchronous condition.
  • WhereAsync (for Task<IEnumerable>): Filters elements asynchronously using an asynchronous condition.
  • WhereAsync (for IAsyncEnumerable): Filters elements asynchronously using an asynchronous condition.

Usage

To use these extensions, include the provided code in your C# project and ensure that the appropriate namespaces (System.Linq, etc.) are referenced. Make sure that you have the necessary dependencies and target framework version set correctly.

Feel free to explore and leverage these extensions to incorporate async operations into your LINQ queries.

Note: This code snippet is a standalone C# implementation and can be integrated into your project to extend the LINQ

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 was computed.  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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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.0.3 467 6/30/2023
1.0.2 257 6/30/2023
1.0.1 255 6/30/2023
1.0.0 271 6/30/2023