Advertisement
kiril_dishliev

IEnumerableCollections ForEach C#

Dec 4th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace IECollections
  5. {
  6.     public static class IEnumerableCollections
  7.     {
  8.         public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
  9.         {
  10.             foreach (var item in collection)
  11.             {
  12.                 action(item);
  13.             }
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement