Showing posts with label OUT Parameter. Show all posts
Showing posts with label OUT 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.

OUT Parameter

OUT parameters are parameters which are passed back from a function to the calling function or method, it is good enough to declare the parameters in the calling method they need not be initialized in the calling class, instead their values will be assigned in the function which is returning the out parameters.

OUT parameters are declared similar to the normal parameters by adding an out keyword in front of the parameter as follows.