Skip to content

Commit

Permalink
Fix the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
atir-naveed-geeksltd committed May 3, 2023
1 parent ae56451 commit 742a6db
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions Olive/-Extensions/Linq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,29 +374,6 @@ public static void Do<T>(this IEnumerable<T> @this, Action<T, int> action)
}
}

/// <summary>
/// Performs an action for all items within the list.
/// </summary>
public static Task DoAsync<T>(this IEnumerable<T> @this, Func<T, Task> action)
=> @this.DoAsync((x, i) => action(x));

/// <summary>
/// Performs an action for all items within the list.
/// It will provide the index of the item in the list to the action handler as well.
/// </summary>
public static async Task DoAsync<T>(this IEnumerable<T> @this, Func<T, int, Task> action)
{
if (@this == null || action == null) return;

var index = 0;

foreach (var item in @this)
{
await action(item, index).ConfigureAwait(false);
index++;
}
}

/// <summary>
/// Performs an action for all items within the list.
/// </summary>
Expand Down

0 comments on commit 742a6db

Please sign in to comment.