Last active
December 18, 2015 21:19
-
-
Save Grinderofl/5846543 to your computer and use it in GitHub Desktop.
A proposal for multiple return values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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