Skip to content

Instantly share code, notes, and snippets.

@hoffstein
Created July 18, 2011 15:33
Show Gist options
  • Save hoffstein/1089871 to your computer and use it in GitHub Desktop.
Save hoffstein/1089871 to your computer and use it in GitHub Desktop.
C# Extension Method To Add ForEach To Any IEnumerable
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