c# return a reference to an object code example
Example 1: c# ref
void Method(ref int refArgument)
{
refArgument = refArgument + 44;
}
int number = 1;
Method(ref number);
Console.WriteLine(number);
// Output: 45
Example 2: cannot initialize a by-value variable with a reference
// must declare variable as ref as well!
ref int x = ref SomeClass.variable;