Guest User

Untitled

a guest
Jun 24th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using System.Threading.Tasks;
  2.  
  3. namespace System.Collections.Generic
  4. {
  5. public static class EnumerableExtensions
  6. {
  7. public static void ForEach<T>(this IEnumerable<T> items, Action<T> action)
  8. {
  9. foreach (T item in items)
  10. {
  11. action.Invoke(item);
  12. }
  13. }
  14.  
  15. public static async Task ForEach<T>(this IEnumerable<T> items, Func<T, Task> action)
  16. {
  17. foreach (T item in items)
  18. {
  19. await action.Invoke(item);
  20. }
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment