Public Class MyCollection
Inherits CollectionBase
Implements ICloneable
#Region " ICloneable Implementation "
Private Function IClone() As Object Implements ICloneable.Clon e
'Implemented in Public Function Clone()
End Function
Public Function Clone() As MyCollection
'---------------------------------------------------------------------------
------
'Create a copy of the collection
'---------------------------------------------------------------------------
------
Dim collection As New MyCollection()
'Loop through each item and add it to the copy
Dim item As MyObject
For Each item In Me.InnerList
'Use InnerList to prevent raising events ?????
collection.Inne rList.Add(eProj ect)
Next
'Return the copy
Return collection
End Function
#End Region
End Class
'------------------------------------------------------------------
'Clone the second collection
MyFirstCollecti on = MySecondCollect ion.Clone
'Clear the second collection
MySecondCollect ion.Clear
Stephen
"phx" <hd****@yahoo.c om> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
I have to collection that stores the items from the same class. I want
to copy the items of the second collection to the first one , and empty the
second.
first.clean()
first=second
second()
causes an error in the program , it seems when i clear the second one ,
alse referances in the first one also empties. Anyway to clone these?
thank you