To use a
ref
parameter, both the method definition and the calling method must explicitly use the
ref
keyword. E.g:
class RefExample
{
static void Method(ref int i)
{
i = 44;
}
static void Main()
{
int val = 0;
Method(ref val); // val is now 44
}
}