Adam Rakis, I do not like your "Of course it is," because it is not at all obvious.
If you have a string variable that you assign to another string variable, you do not change them when you make changes to one of them. They do not point to the same physical part of the memory, so why is it obvious what classes do?
In addition, the case is not even agreed. In the following case, you will have all the elements in the array pointing to the same object (they all end with the Number variable set to 10:
SourceObject = New SomeClass For i = 1 To 10 SourceObject.Number = i ObjectArray.Add = SourceObject Next i
BUT, the following will give you 10 different instances:
For i = 1 To 10 SourceObject = New SomeClass SourceObject.Number = i ObjectArray.Add = SourceObject Next i
Apparently, the scope of the object matters, so itβs not at all obvious what is happening.
Frankb
source share