Skip to content

Instantly share code, notes, and snippets.

@devoyster
Created December 22, 2011 20:50
Show Gist options
  • Save devoyster/1511801 to your computer and use it in GitHub Desktop.
Save devoyster/1511801 to your computer and use it in GitHub Desktop.
LINQ to Objects ForEach()
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