Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class RefLocals
{
private int _age = 15;
public void ReferenceToField()
{
ref int someReferenceToAge = ref _age;
someReferenceToAge = 45;
}
public void PrintAge()
{
Console.WriteLine($"Age: {_age}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment