Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.