Skip to content

Instantly share code, notes, and snippets.

@valvallow
Forked from cryks/gist:2566761
Created May 1, 2012 11:01
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 valvallow/2567334 to your computer and use it in GitHub Desktop.
Save valvallow/2567334 to your computer and use it in GitHub Desktop.
public static class Values {
public static void Receive<T1, T2>(this Tuple<T1, T2> tuple, out T1 item1, out T2 item2) {
item1 = tuple.Item1;
item2 = tuple.Item2;
}
public static void CallWith<T1, T2>(this Tuple<T1, T2> tuple, Action<T1, T2> func) {
func(tuple.Item1, tuple.Item2);
}
}
int a, b;
Tuple.Create(1, 2).Receive(out a, out b);
Tuple.Create(3, 4).CallWith((c, d) => Console.WriteLine(c + d));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment