K
Kyote
I'm trying to persist a list of filenames. I've made a custom
collection and a FileName class:
'Class to hold file name information
Public Class FileNames
Public fullName As String
Public fileName As String
Public fileExtention As String
Public filePath As String
Public newName As String
End Class
Now I create a new object and fill the above strings then add it to my
custom collection. So far this all works just fine.
Now, once I've iterated through my collection and performed the
actions on each item I wish to perform it's done. But I got tired of
reloading the same list each time I decided to work on the same files,
so I thought to copy the collection before I made my changes. I tried
myBackupQueue = myQueue
and that seemed to work, until I went to reload the collection anyway.
What I'm doing is emptying the original list right before I try to do
myQueue = myBackupQueue
But this here seems to be my problem. I could be wrong but it seems
that when I originally make my copy of the collection with
myBackupQueue = myQueue
thats it's only putting a reference to each object contained in the
original myQueue because when I empty it out like:
myQueue.Clear()
both myQueue and myBackupQueue are emptied. Maybe I'm just tired, but
I can't think of a way around this.
Can anyone see what's happening and what I can do to accomplish what
I'm trying to do? Any constructive help would be HIGHLY appreciated.
collection and a FileName class:
'Class to hold file name information
Public Class FileNames
Public fullName As String
Public fileName As String
Public fileExtention As String
Public filePath As String
Public newName As String
End Class
Now I create a new object and fill the above strings then add it to my
custom collection. So far this all works just fine.
Now, once I've iterated through my collection and performed the
actions on each item I wish to perform it's done. But I got tired of
reloading the same list each time I decided to work on the same files,
so I thought to copy the collection before I made my changes. I tried
myBackupQueue = myQueue
and that seemed to work, until I went to reload the collection anyway.
What I'm doing is emptying the original list right before I try to do
myQueue = myBackupQueue
But this here seems to be my problem. I could be wrong but it seems
that when I originally make my copy of the collection with
myBackupQueue = myQueue
thats it's only putting a reference to each object contained in the
original myQueue because when I empty it out like:
myQueue.Clear()
both myQueue and myBackupQueue are emptied. Maybe I'm just tired, but
I can't think of a way around this.
Can anyone see what's happening and what I can do to accomplish what
I'm trying to do? Any constructive help would be HIGHLY appreciated.