TaskForgeSparks 1.0.3

dotnet add package TaskForgeSparks --version 1.0.3
                    
NuGet\Install-Package TaskForgeSparks -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="TaskForgeSparks" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TaskForgeSparks" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="TaskForgeSparks" />
                    
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 TaskForgeSparks --version 1.0.3
                    
#r "nuget: TaskForgeSparks, 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 TaskForgeSparks@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=TaskForgeSparks&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=TaskForgeSparks&version=1.0.3
                    
Install as a Cake Tool

TaskForgeSparks

Overview

TaskForgeSparks is a .NET library that provides utilities for concurrent processing of lists of entities. It offers methods to divide a list into subsets and execute actions in parallel on each subset using action blocks. This allows for efficient handling of asynchronous workflows, optimizing resource utilization while ensuring faster execution.

Installation

You can install TaskForgeSparks via NuGet Package Manager:

Install-Package TaskForgeSparks -Version 1.0.3

Usage

ProcessServicesInThread

This method processes a list of entities concurrently by dividing the list into subsets and executing an action in parallel on each subset using action blocks.

public static async Task ProcessServicesInThread<T>(IList<T> CollectionsEntities, Action<T> action, int byService = 50) where T : class
  • CollectionsEntities: The list of entities to process.
  • action: The action to execute on each entity.
  • byService (optional): The size of the subset of entities processed in each thread (default: 50).

ProcessServicesInThread (Async)

This method processes a list of entities concurrently using asynchronous functions, allowing for better utilization of system resources without blocking the main thread.

public static void ProcessServicesInThread<T>(IList<T> CollectionsEntities, Func<T, Task> action, int byService = 50) where T : class
  • CollectionsEntities: The list of entities to process.
  • action: The asynchronous function to perform on each entity.
  • byService (optional): The size of the subset of entities processed in each thread (default: 50).

Additional Notes

  • For both methods, if excessive waiting time is observed when using asynchronous methods, it may indicate inefficiencies in the workflow.
  • The library dynamically calculates thread allocations based on the total count of elements and the default count specified.
  • The library utilizes the available processor count for parallel execution, optimizing performance.

Example

using TaskForgeSparks;

var entities = GetEntities(); // Get list of entities
await TaskFlowManager.ProcessServicesInThread(entities, entity => ProcessEntity(entity));

License

This library is licensed under the MIT License. See the LICENSE file for details.


Developed by TaskForgeSparks Team.

Product Compatible and additional computed target framework versions.
.NET 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 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.
  • net6.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 291 3/28/2024
1.0.2 183 3/28/2024
1.0.1 171 3/28/2024
1.0.0 204 3/28/2024