Why do I need to use ref keyword in both declaration and call?
03:21 06 Oct 2009

Why do I need to use the 'ref' keyword in both declaration and call.

void foo(ref int i)
{
            
}

For example, Consider above function. If I will call it without ref keyword as

foo(k);

it will give me error :

Argument '1' must be passed with the 'ref' keyword

Why isn't it enough to just specify in the method signature only ?

c# keyword ref