Skip to content

Instantly share code, notes, and snippets.

@bruno-garcia
Last active December 26, 2017 17:59
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 bruno-garcia/c7cc29b1e76fb32cb2b7c16b7fe4d778 to your computer and use it in GitHub Desktop.
Save bruno-garcia/c7cc29b1e76fb32cb2b7c16b7fe4d778 to your computer and use it in GitHub Desktop.
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