Created
August 6, 2020 09:31
-
-
Save mgravell/c46a1de553abe325dea0c44ac7fa7766 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
class Foo | |
{ | |
int _value; | |
public ref int Value => ref _value; | |
static void Main() | |
{ | |
var obj = new Foo { Value = 12 }; | |
Console.WriteLine(obj.Value); | |
obj.Value = 42; | |
Console.WriteLine(obj.Value); | |
Magic(ref obj.Value); | |
Console.WriteLine(obj.Value); | |
} | |
static void Magic(ref int evil) => evil++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment