Skip to content

Commit a84470c

Browse files
author
Ron Petrusha
authored
Corrected method name (dotnet#8482)
1 parent adc26c9 commit a84470c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/visual-basic/programming-guide/language-features/procedures/how-to-protect-a-procedure-argument-against-value-changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If a procedure declares a parameter as [ByRef](../../../../visual-basic/language
2929

3030
[!code-vb[VbVbcnProcedures#37](./codesnippet/VisualBasic/how-to-protect-a-procedure-argument-against-value-changes_3.vb)]
3131

32-
The first `MsgBox` call displays "After increase(n): 11, 21, 31, 41". Because the array `n` is a reference type, `replace` can change its members, even though the passing mechanism is `ByVal`.
32+
The first `MsgBox` call displays "After increase(n): 11, 21, 31, 41". Because the array `n` is a reference type, `increase` can change its members, even though the passing mechanism is `ByVal`.
3333

3434
The second `MsgBox` call displays "After replace(n): 11, 21, 31, 41". Because `n` is passed `ByVal`, `replace` cannot modify the variable `n` in the calling code by assigning a new array to it. When `replace` creates the new array instance `k` and assigns it to the local variable `a`, it loses the reference to `n` passed in by the calling code. When it changes the members of `a`, only the local array `k` is affected. Therefore, `replace` does not increment the values of array `n` in the calling code.
3535

0 commit comments

Comments
 (0)