Dim s1 as string = "Fred"
Dim s2 as string = s1
Both s1 and s2 point to the same string. There's no duplication. String s1 can be a million characters in length; they would both point to the same string (and, indeed, would 'equal' each other).
Strings are a bit funky, though, in that once they are created they can never be changed. The phrase that is bandied about is 'immutable'.
There isn't any inefficiency at all, beyond the fact that an intermediate variable would be created to hold a reference to the object in question. The few bytes or so is really not an issue if you are using objects and code which consumes megabytes of memory.




Reply With Quote