The reason that you had to use the Clone method was that you were copying the Array object, not the structure. This works for copying the structure value:
Dim myStructArray(0) As MyStruct
myStructArray(0).MyPoint = New Point(10, 10)
myStructArray(0).MyBool = True
Dim myCopyArray(0) As MyStruct
myCopyArray(0) = myStructArray(0) 'copy structure instead of array
myCopyArray(0).MyBool = False
myCopyArray(0).MyPoint = New Point(11, 11)
In this case it's of course totally pointless to copy the structure as you are replacing all the values, but the copying does work, leaving you with two separate arrays instead of two references to the same array.
A structure should generally be immutable, i.e. it's properties are read-only, which protects you from situations like this:
Dim myStructList(Of MyStruct) As New myStructList(Of MyStruct)()
myStructList.Add(New MyStruct())
myStructList(0).MyPoint = New Point(10, 10) 'doesn't work
The reason that this doesn't work is that myStructList(0) returns a copy of the structure. The MyPoint member of the copy is changed, but the copy of the structure is never written back to the list.
This is the immutable structure:
Structure MyStruct
Private _myPoint As Point
Private _myBool As Boolean
Public Readonly Property MyPoint As Point
Get
Return _myPoint
End Get
End Property
Public Readonly Property MyBool As Boolean
Get
Return _myBoolean
End Get
End Property
Public Sub New(ByVal myPoint As Point, ByVal myBool As Boolean)
_myPoint = myPoint
_myBool = myBool
End Sub
End Structure
You create a new value using the constructor:
Dim myStructList(Of MyStruct) As New myStructList(Of MyStruct)()
myStructList.Add(New MyStruct(New Point(10, 10), True))
You can still copy the whole structure value:
Dim myStructArray(0) As MyStruct
myStructArray(0) = New MyStruct(New Point(10, 10), True)
Dim myCopyArray(0) As MyStruct
myCopyArray(0) = myStructArray(0) 'copy structure value