© { JSL }
22
Text Box: ref Parameters
ref Parameters
Folded Corner:
·a ref parameter is an alias for the argument
wno copy takes place
wargument must be definitely assigned
wargument must be an "lvalue"
wref required on argument and parameter
static void Method(ref Pair parameter)
{
    parameter = new Pair(42,42);
}
static void Main()
{
    Pair arg = null;
    //Console.WriteLine(p.X);
    Method(ref arg);
    Console.WriteLine(arg.X);
}
42
Method( ref type [ ] array ) allowed