Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bfarmer67 committed Nov 25, 2024
1 parent e5c013d commit a26d32c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Hyperbee.Collections/Extensions/IEnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ namespace Hyperbee.Collections.Extensions;

public static class IEnumerableExtensions
{
// ParallelEachAsync
//
// Executes the specified asynchronous action on each element of the
// enumerable in parallel, with support for limiting concurrency and cancellation.
//
// Parameters:
// - source: The enumerable to process.
// - asyncAction: The asynchronous action to execute on each element.
// - maxDegreeOfParallelism: The maximum number of concurrent tasks.
// - cancellationToken: The cancellation token to monitor for cancellation requests.
//
// Returns:
// A task that represents the completion of all asynchronous operations.
//
// Example:
// var testData = Enumerable.Range(1, 100);
// await testData.ParallelEachAsync(async item =>
// {
// await ProcessItemAsync(item);
// }, maxDegreeOfParallelism: 4);
//

public static Task ParallelEachAsync<T>(
this IEnumerable<T> source,
Func<T, Task> asyncAction,
Expand Down

0 comments on commit a26d32c

Please sign in to comment.