the rules are as follows
1. if you pass a reference type byval you are creating a copy of the pointer
to the object in the stack.
both pointers point to a single instance of the object in the heap.
2. if you pass a reference type byref, you are using the original pointer in
the stack.
3. if you pass a value type byval, you are creating a copy of the variable
in the stack.
(changes will not affect original variable)
4. if you pass a value type byref, you are using the original value in the
stack.
( changes will affect original variable)
Kirk Graves
"Scott M." <s-***@badspamsnet.net> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
If I pass a reference type ByVal, am I making a copy of the object on the
heap or am I making a copy of a pointer to the object on the heap?
If I pass a string object (reference type) into a sub ByVal and modify it,
the original string doesn't change. If I pass it ByRef it does.
This makes it seem like the actual type (reference or value) that is being
passed is irrelevant and that only the ByVal or ByRef keyword matters.
Is this true?