vote buttons
1
1
beginner
0
intermediate
0
advanced
16-Nov-2014 04:21 UTC
K Bonneau
350

2 Answers

vote buttons
1

ref is used when we want to use the variable passed to a function as both input and output. 

out is used when the variable is output only.

In case of out parameters, you cannot leave the value undefined, you must assign a value to it before exiting the function. Such restriction is not in place for ref parameters and the variable's initial value is the same as when passed to the function.

16-Nov-2014 04:21 UTC
K Bonneau
350
vote buttons
-1

Ref

Ref keyword is used to pass an argument as a reference.When the value of the parameters changed in the methods that it will change in the calling method.The ref keyword must be initialized in the calling method before it is passed to the called method.

Out

The out keyword is also used to pass an argument but the argument can be passed without assigning any value to it and the out keyword must be initialized in the called method before it return back to the calling method.You can get the more info about the ref and  out keyword from the internet or other sources.


11-Feb-2015 10:35 UTC
anitadoud
-2