Skip to content

Instantly share code, notes, and snippets.

@akimboyko
Forked from palladin/gist:8577661
Created January 23, 2014 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akimboyko/8584781 to your computer and use it in GitHub Desktop.
Save akimboyko/8584781 to your computer and use it in GitHub Desktop.
public static class EnumerableEx
{
public static IEnumerable<R> Select<T1, T2, R>(this IEnumerable<Tuple<T1, T2>> source, Func<T1, T2, R> f)
{
return source.Select(t => f(t.Item1, t.Item2));
}
}
Enumerable.Range(1, 10)
.Select(x => Tuple.Create(x, x))
.Select(tuple => tuple.Item1 + tuple.Item2);
// F# style
Enumerable.Range(1, 10)
.Select(x => Tuple.Create(x, x))
.Select((first, second) => first + second);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment