ForEachExtension.cs 318 B

12345678910111213141516
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace System
  5. {
  6. public static class ForEachExtension
  7. {
  8. public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
  9. {
  10. foreach (T item in source)
  11. action(item);
  12. }
  13. }
  14. }