Last active
December 26, 2017 17:59
-
-
Save bruno-garcia/c7cc29b1e76fb32cb2b7c16b7fe4d778 to your computer and use it in GitHub Desktop.
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
class Program | |
{ | |
static void Main() | |
{ | |
var a = 1; | |
ref var b = ref Increment(ref a); | |
b++; | |
var c = Increment(ref b); | |
c++; | |
System.Console.WriteLine($@"a: {a} | |
b: {b} | |
c: {c}"); | |
ref int Increment(ref int input) | |
{ | |
input++; | |
return ref input; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment