TaskParallelismControl 0.1.0-beta.1
This is a prerelease version of TaskParallelismControl.
dotnet add package TaskParallelismControl --version 0.1.0-beta.1
NuGet\Install-Package TaskParallelismControl -Version 0.1.0-beta.1
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="TaskParallelismControl" Version="0.1.0-beta.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TaskParallelismControl" Version="0.1.0-beta.1" />
<PackageReference Include="TaskParallelismControl" />
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 TaskParallelismControl --version 0.1.0-beta.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TaskParallelismControl, 0.1.0-beta.1"
#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 TaskParallelismControl@0.1.0-beta.1
#: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=TaskParallelismControl&version=0.1.0-beta.1&prerelease
#tool nuget:?package=TaskParallelismControl&version=0.1.0-beta.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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.1.0-beta.1 | 52 | 2/12/2026 |
| 0.0.1-alpha.1 | 49 | 1/27/2026 |