I have never had the need to specifically pass an array By Ref. I didn’t even know that it was a thing. The default behavior (no ByRef) aligned with my thinking. But you can construct an example to show that the behavior does change under some circumstances when you pass ByRef or not.
For the concrete thinker among us, here is an example
Calling Method
Var a(2) As Integer
a(0) = 1
a(1) = 2
a(2) = 3
Var b(2) As Integer
b(0) = 2
b(1) = 4
b(2) = 6
SquArr(a,b)
MessageBox("a equals: " + a(0).ToString + " " + a(1).ToString + " " + a(2).ToString+EndOfLine+"b equals: "+b(0).ToString + " " + b(1).ToString + " " + b(2).ToString)
See the Function (SquArr) that is being called by the Calling Method. Neither parameter is passed ByRef.
Private Sub SquArr(someArray() As Integer, anotherArray() As Integer)
someArray = anotherArray
For nIndex As Integer = 0 To someArray.LastIndex
someArray(nIndex) = someArray(nIndex) ^ 2
Next nIndex
End Sub
The results:
a equals: 1 2 3
b equals: 4 16 36
Now try it with the same basic Function but change the parameters:
Private Sub SquArr(ByRef someArray() As Integer, anotherArray() As Integer)
someArray = anotherArray
For nIndex As Integer = 0 To someArray.LastIndex
someArray(nIndex) = someArray(nIndex) ^ 2
Next nIndex
End Sub
The only difference is that this time you are calling: ByRef someArray.
anotherArray is not being called ByRef
The result is
a equals: 4 16 36
b equals: 4 16 36
So it clearly makes a difference. Perhaps this helps with trying to visualize this business of a pointer vs a pointer to a pointer