Created
July 18, 2011 15:33
-
-
Save hoffstein/1089871 to your computer and use it in GitHub Desktop.
C# Extension Method To Add ForEach To Any IEnumerable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) | |
{ | |
foreach (T item in source) | |
action(item); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment