Skip to content

Instantly share code, notes, and snippets.

@Grinderofl
Last active December 18, 2015 21:19
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 Grinderofl/5846543 to your computer and use it in GitHub Desktop.
Save Grinderofl/5846543 to your computer and use it in GitHub Desktop.
A proposal for multiple return values
public class MyClass
{
public void MyMethod()
{
var x, y, z = MyReturnMethod();
Console.WriteLine("{0} {1} {2}", x, y, z);
// 10 Hello <now>
var var1 = MyReturnMethod();
Console.WriteLine(var1);
// 10
string s = MyReturnMethod();
Console.WriteLine(s);
// Hello
string myString, DateTime date = MyReturnMethod();
Console.WriteLine("{0} {1}", myString, date);
// Hello <now>
var v1:y, v2:x = MyReturnMethod();
Console.WriteLine("{0} {1}", v1, v2);
// Hello 10
}
public int, string, DateTime MyReturnMethod()
{
int x = 10;
string y = "Hello";
DateTime z = DateTime.Now;
return x, y, z;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment