Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Threading.Tasks;
- namespace System.Collections.Generic
- {
- public static class EnumerableExtensions
- {
- public static void ForEach<T>(this IEnumerable<T> items, Action<T> action)
- {
- foreach (T item in items)
- {
- action.Invoke(item);
- }
- }
- public static async Task ForEach<T>(this IEnumerable<T> items, Func<T, Task> action)
- {
- foreach (T item in items)
- {
- await action.Invoke(item);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment