RE: Passing arrays ByVal vs ByRef
- From: David Anton <DavidAnton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Apr 2009 07:25:01 -0700
You are correct - you would need to make a copy.
VB & C# (or Java) have no concept of marking a parameter as 'unmodifiable
internals'. You can always modify the 'internals' of the object being passed
- with reference objects, the only thing you can prevent is whether the
top-level reference is modified.
--
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
"Schizoid Man" wrote:
Hello,.
I have run into a bit of a problem when passing arrays ByVal between
functions - it seems that any modifications to the passed array in the
called method will be reflected in the calling method.
A quick Web search shows that this is, in fact, the expected VB.Net
behavior. What is the way around this - is the correct procedure to make a
copy of the array in the called method and modify that?
Thanks,
Schiz
- Follow-Ups:
- Re: Passing arrays ByVal vs ByRef
- From: Scott M.
- Re: Passing arrays ByVal vs ByRef
- Prev by Date: RE: vb2008: How to collapse code inside methods
- Next by Date: Re: How to keep Application Window ALIVE despite CONSTANT LOOP???
- Previous by thread: vb2008: How to collapse code inside methods
- Next by thread: Re: Passing arrays ByVal vs ByRef
- Index(es):
Relevant Pages
|