EnumerableExtensions.cs 774 B

12345678910111213141516171819202122
  1. namespace Caliburn.Micro.Core {
  2. using System;
  3. using System.Collections.Generic;
  4. /// <summary>
  5. /// Extension methods for <see cref="IEnumerable&lt;T&gt;"/>
  6. /// </summary>
  7. public static class EnumerableExtensions {
  8. /// <summary>
  9. /// Applies the action to each element in the list.
  10. /// </summary>
  11. /// <typeparam name="T">The enumerable item's type.</typeparam>
  12. /// <param name="enumerable">The elements to enumerate.</param>
  13. /// <param name="action">The action to apply to each item in the list.</param>
  14. public static void Apply<T>(this IEnumerable<T> enumerable, Action<T> action) {
  15. foreach (var item in enumerable) {
  16. action(item);
  17. }
  18. }
  19. }
  20. }