+ 1
What does the ref keyword do?
I'm guessing it means reference, but what exactly does it do?
1 Odpowiedź
+ 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.