Created
December 22, 2011 20:50
-
-
Save devoyster/1511801 to your computer and use it in GitHub Desktop.
LINQ to Objects ForEach()
This file contains 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) | |
{ | |
if (action == null) | |
{ | |
throw new ArgumentNullException("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