ref and out both allow the called method to modify a parameter. The difference between them is what happens before you make the call. ref means that the parameter has a value on it before going into the function. out means that the parameter has no official value before going into the function. Example: then it produce the following result: if you not initialize the val1 with any value then your code not compile. Error:Use of unassigned local variable 'val1'
ref and out both allow the called method to modify a parameter. The difference between them is what happens before you make the call.
ref means that the parameter has a value on it before going into the function.
out means that the parameter has no official value before going into the function.