Iciclecreek.Async 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Iciclecreek.Async --version 2.0.0                
NuGet\Install-Package Iciclecreek.Async -Version 2.0.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="Iciclecreek.Async" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Iciclecreek.Async --version 2.0.0                
#r "nuget: Iciclecreek.Async, 2.0.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.
// Install Iciclecreek.Async as a Cake Addin
#addin nuget:?package=Iciclecreek.Async&version=2.0.0

// Install Iciclecreek.Async as a Cake Tool
#tool nuget:?package=Iciclecreek.Async&version=2.0.0                

Iciclecreek.Async

Async extensions for LINQ and PLINQ queries

SelectParallelAsync()

This allows you to run an async select task which runs each task in parallel, with max parallelism.

You can use it with a normal enumerable:

    // using an enumerable, will max 10 tasks at a time concurrently
    var results = enumerable
        .SelectParallelAsync(async (item, index) =>
        {
            await ...;
            return result;
        }, maxParallel: 10)
        .ToList();

You can use it with a ParallelQuery

    // using an enumerable, will max 10 tasks at a time concurrently
    var results = enumerable
        .AsParallel()
        .WithDegreeOfParallelism(10)
        .SelectParallelAsync(async (item, index) =>
        {
            await ...;
            return result;
        })
        .ToList();

WhereParallelAsync()

This allows you to run an async Where() task which runs each task in parallel, with max parallelism.

You can use it with a normal enumerable:

    // using an enumerable, will max 10 tasks at a time concurrently
    var results = enumerable
        .WhereParallelAsync(async (item, index) =>
        {
            await ...;
            return true/false;
        }, maxParallel: 10)
        .ToList();

You can use it with a ParallelQuery

    // using an enumerable, will max 10 tasks at a time concurrently
    var results = enumerable
        .AsParallel()
        .WithDegreeOfParallelism(10)
        .WhereParallelAsync(async (item, index) =>
        {
            await ...;
            return true/false;
        })
        .ToList();

WaitAll()

WaitAll() will await all items in an enumerable of Task<> and return the result of the tasks.

    var results = enumerable
        .Select(async (item) => 
        {
            await ...;
            return result;
        })
        .WaitAll() // turns IEnumerable<Task<X>> => IEnumerable<X>

NOTE: You don't need to use WaitAll() on result of SelectParallelAsync(). It does the equivelent of WaitAll() internally.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Iciclecreek.Async:

Package Downloads
Linq.AI

Linq extensions for AI transformations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 108 10/11/2024
2.0.0 215 9/12/2024
1.1.0 115 9/11/2024
1.0.3 115 9/10/2024
1.0.2 99 9/9/2024
1.0.1 99 9/9/2024
1.0.0 95 9/9/2024