I have a class :
Public Class ClassLine
Private m_Name As String
Private m_ArrayY As Double()
Public Function ShallowCopy() As ClassLine ' this lets to clone the details of a class, but NOT a REFERENCE !
(See this to understand ShallowCopy:
Well...If I use this on the form:
Dim L1 As ClassLine = L.ShallowCopy
All is cloned ok, except the ARRAY !
That's it :
If I have : L.name= "Rufus"
and I have cloned on L1, after do the shallow copy I can do: L.name="pipo", and L1.name is still with : L.name= "Rufus"
But is I modify the Array, the data is also modified on L1 .... WHY ? ? ?
How can I solve it ? ?
I tried this :
L1.ArrayY = L.ArrayY
L1.Name = L.Name
and this :
Dim ArrayTemp() As Double = L.ArrayY
For i = 0 To UBound(L.ArrayY)
ArrayTemp(i) = L.ArrayY(i)
L1.ArrayY = ArrayTemp
But still the same reference....
Any ideas ? ? ?