Showing posts with label REF Parameter. Show all posts
Showing posts with label REF Parameter. Show all posts

Tuesday, May 28, 2013

OUT vs REF Parameters

OUT and REF parameters are almost similar, both are used to return additional values from a function to the code which is calling the function. However there are some difference between the two, the following are the some of the key differences between the OUT and REF parameters.

Out parameters are declared by adding the keyword out in front of the parameter.

REF Parameter

REF parameters are parameters which are passed between the calling function and the function being called, we need to declare and initialize the parameters in the calling method, their values will be re-assigned in the actual function and returned back to the calling function.

REF parameters are declared similar to the normal parameters by adding a ref keyword in front of the parameter as follows.