Skip to content

Instantly share code, notes, and snippets.

@dterracino
Forked from joelmartinez/iter.cs
Created July 28, 2017 05:19
Show Gist options
  • Save dterracino/b997f4ca2df494c30508c53b66417b4c to your computer and use it in GitHub Desktop.
Save dterracino/b997f4ca2df494c30508c53b66417b4c to your computer and use it in GitHub Desktop.
A simple extension method that gives you the "Iter" function from F#
static class x10 {
public static IEnumerable<T> Iter<T>(this IEnumerable<T> list, Action<T> action) {
foreach (var n in list) {
action (n);
yield return n;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment