jerry_hokh
Active member
- Joined
- Mar 14, 2006
- Messages
- 25
- Programming Experience
- 1-3
Hi all,
It's would be appreciated if any body can help me this:
I have the following class:
Public Class cell
Implements ICloneable
Public name As String
Public Function Clone() As Object Implements System.ICloneable.Clone
Dim c As cell = Me.MemberwiseClone
Return c
End Function
End Class
-----
Public Class main
Public Shared Sub main()
Dim arr As New ArrayList
For i As Integer = 0 To 10
Dim cell As New cell
arr.Add(cell)
Next
Dim arr2 As New ArrayList
arr2 = arr.clone
CType(arr(5), cell).name = "jerry"
End Sub
End Class
------
** the problem is I only change the 5th cell's name to "jerry" in arr, but in arr2's 5th cell'name is also change to "jerry" .I want arr2's 5th cell'name remain nothing
thanks alot for any help.
Jerry.
It's would be appreciated if any body can help me this:
I have the following class:
Public Class cell
Implements ICloneable
Public name As String
Public Function Clone() As Object Implements System.ICloneable.Clone
Dim c As cell = Me.MemberwiseClone
Return c
End Function
End Class
-----
Public Class main
Public Shared Sub main()
Dim arr As New ArrayList
For i As Integer = 0 To 10
Dim cell As New cell
arr.Add(cell)
Next
Dim arr2 As New ArrayList
arr2 = arr.clone
CType(arr(5), cell).name = "jerry"
End Sub
End Class
------
** the problem is I only change the 5th cell's name to "jerry" in arr, but in arr2's 5th cell'name is also change to "jerry" .I want arr2's 5th cell'name remain nothing
thanks alot for any help.
Jerry.