+ 1

What does the ref keyword do?

I'm guessing it means reference, but what exactly does it do?

26th Nov 2016, 5:16 PM
Robert Craig
Robert Craig - avatar
1 Respuesta
+ 9
Sure it means reference ; The ref keyword causes an argument to be passed by reference, not by value. The effect of passing by reference is that any change to the parameter in the called method is reflected in the calling method. For example, if the caller passes a local variable expression or an array element access expression, and the called method replaces the object to which the ref parameter refers, then the caller’s local variable or the array element now refer to the new object.
26th Nov 2016, 9:24 PM
Hassan Amr
Hassan Amr - avatar