Skip to content

Instantly share code, notes, and snippets.

@renestein
Created April 16, 2012 07:20
Show Gist options
  • Save renestein/2396903 to your computer and use it in GitHub Desktop.
Save renestein/2396903 to your computer and use it in GitHub Desktop.
Ix - foreach
public static void ForEach<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext)
{
if (source == null)
{
throw new ArgumentNullException("source");
}
if (onNext == null)
{
throw new ArgumentNullException("onNext");
}
foreach (TSource current in source)
{
onNext(current);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment