On page 99 (I think) there is a discussion that the default for parameters is ByVal in
VB.Net vs. ByRef in VB6. Then the text goes on to state that this is much better because ByRef is higher overhead because the data must be copied to the sub or function and then copied back once the sub or function completes.
I hope that this is an incorrect description of the way ByRef parameters are passed. I believe that the address of the ByRef variable(s) are copied at the call to the subprogram. Then the subprogram uses/modifies the variable that is in one, and only location, in memory. At the exit from the subprogram there is no copying back of the ByRef parameters.
If my understanding of subprogram calls is correct, then the book is wrong. ByVal parameters have higher overhead but are much safer because they remove the possibility of unintended consequences of data modification for the calling program.
Any feedback would be appreciated.
Greg
[email protected]