Skip to content

Instantly share code, notes, and snippets.

@codereflection
Created September 29, 2010 20:40
Show Gist options
  • Select an option

  • Save codereflection/603520 to your computer and use it in GitHub Desktop.

Select an option

Save codereflection/603520 to your computer and use it in GitHub Desktop.
public static IEnumerable<T> Each<T>(this IEnumerable<T> things, Action<T> action)
{
if (things == null)
yield break;
foreach (var thing in things)
{
action(thing);
yield return thing;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment