magnilucaTaskParallelismControl 0.0.1-alpha.1
dotnet add package magnilucaTaskParallelismControl --version 0.0.1-alpha.1
NuGet\Install-Package magnilucaTaskParallelismControl -Version 0.0.1-alpha.1
<PackageReference Include="magnilucaTaskParallelismControl" Version="0.0.1-alpha.1" />
<PackageVersion Include="magnilucaTaskParallelismControl" Version="0.0.1-alpha.1" />
<PackageReference Include="magnilucaTaskParallelismControl" />
paket add magnilucaTaskParallelismControl --version 0.0.1-alpha.1
#r "nuget: magnilucaTaskParallelismControl, 0.0.1-alpha.1"
#:package magnilucaTaskParallelismControl@0.0.1-alpha.1
#addin nuget:?package=magnilucaTaskParallelismControl&version=0.0.1-alpha.1&prerelease
#tool nuget:?package=magnilucaTaskParallelismControl&version=0.0.1-alpha.1&prerelease
TaskParallelismControl
.NET library providing extension methods for executing asynchronous operations in parallel with a controlled degree of parallelism (throttling). Useful to avoid saturating network/CPU/resources when processing large collections.
Features
- Controlled concurrency via a fixed number of worker tasks
- Two overloads:
ExecuteInParallel<T>(Func<T, Task>, ...)ExecuteInParallel<T, TResult>(Func<T, Task<TResult>>, ...)
- Thread-safe implementation based on
ConcurrentQueue<T>andConcurrentBag<TResult>
Installation
If published on NuGet:
dotnet add package TaskParallelismControl
Local feed scenario (see LocalNuget folder in the solution):
dotnet nuget add source <PATH_TO_LocalNuget> -n LocalNuget
dotnet add package TaskParallelismControl --source LocalNuget
Quick start
Example: with results
using TaskParallelismControl;
var urls = new[]
{
"https://learn.microsoft.com/",
"https://learn.microsoft.com/dotnet/",
};
const int maxParallelism = 5;
var results = await urls.ExecuteInParallel(
async url =>
{
using var client = new HttpClient();
var bytes = await client.GetByteArrayAsync(url);
return bytes.Length;
},
maxParallelism);
Console.WriteLine($"Total bytes: {results.Sum()}");
Example: without results
using TaskParallelismControl;
var items = Enumerable.Range(1, 100);
await items.ExecuteInParallel(
async i =>
{
await Task.Delay(50);
Console.WriteLine(i);
},
degreeOfParallelism: 8);
Notes
- Target framework:
net9.0. - Pack with
dotnet pack.
TaskParallelismControl
.NET library providing extension methods for executing asynchronous operations in parallel with a controlled degree of parallelism (throttling). Useful to avoid saturating network/CPU/resources when processing large collections.
Features
- Controlled concurrency via a fixed number of worker tasks
- Two overloads:
ExecuteInParallel<T>(Func<T, Task>, ...)ExecuteInParallel<T, TResult>(Func<T, Task<TResult>>, ...)
- Thread-safe implementation based on
ConcurrentQueue<T>andConcurrentBag<TResult>
Installation
If published on NuGet:
dotnet add package TaskParallelismControl
Local feed scenario (see LocalNuget folder in the solution):
dotnet nuget add source <PATH_TO_LocalNuget> -n LocalNuget
dotnet add package TaskParallelismControl --source LocalNuget
Quick start
Example: with results
using TaskParallelismControl;
var urls = new[]
{
"https://learn.microsoft.com/",
"https://learn.microsoft.com/dotnet/",
};
const int maxParallelism = 5;
var results = await urls.ExecuteInParallel(
async url =>
{
using var client = new HttpClient();
var bytes = await client.GetByteArrayAsync(url);
return bytes.Length;
},
maxParallelism);
Console.WriteLine($"Total bytes: {results.Sum()}");
Example: without results
using TaskParallelismControl;
var items = Enumerable.Range(1, 100);
await items.ExecuteInParallel(
async i =>
{
await Task.Delay(50);
Console.WriteLine(i);
},
degreeOfParallelism: 8);
Notes
- Target framework:
net9.0. - Pack with
dotnet pack.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. 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. |
-
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 |
|---|---|---|
| 0.0.1-alpha.1 | 102 | 1/30/2026 |