Tuesday, June 1, 2010

Difference between Ref vs. Out

The Ref and Our parameters are quiet similar, both parameters are used to return back some value to the caller of the function. But there is a main difference between this two is when we use the out parameter, the program calling the function need not assign a value to the out parameter before making the call to the function. The same is not true for the reference (ref) type parameter. For a ref type parameter, the value to the parameter has to be ssigned before calling the function. If we do not assign the value before calling the function we will get a compiler error.

No comments:

Post a Comment