Skip to content

Instantly share code, notes, and snippets.

@ChrisMissal
Created June 1, 2012 01:16
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 ChrisMissal/2847833 to your computer and use it in GitHub Desktop.
Save ChrisMissal/2847833 to your computer and use it in GitHub Desktop.
Not sure what this is called, anonymous tuple?
// I want to be able to do this in C#
int a = 4;
int b = 2;
(a, b) = (b, a); // swap values
// ... and used in some terribly named methods...
public void AssignValues()
{
var (id, name) = GetValues();
// more statements
}
public int, string GetValues()
{
return (123, "gist");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment