Public Class MyCollection
Inherits CollectionBase
Implements ICloneable
#Region " ICloneable Implementation "
Private Function IClone() As Object Implements ICloneable.Clone
'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.InnerList.Add(eProject)
Next
'Return the copy
Return collection
End Function
#End Region
End Class
'------------------------------------------------------------------
'Clone the second collection
MyFirstCollection = MySecondCollection.Clone
'Clear the second collection
MySecondCollection.Clear
Stephen
"phx" <hd****@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP10.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