ref (C# Reference)

Kajasumanie Kanapathipillai
1 min readNov 6, 2017

When used in a method’s parameter list, the ref keyword indicates that an argument is passed by reference, not by value. The effect of passing by reference is that any change to the argument 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 refers to the new object when the method returns.