P
pamelafluente
Hi
I have a sorted list with several thousands items. In my case, but this
is not important, objects are stored only in Keys, Values are all
Nothing. Several of the stored objects (might be a large number) have
to be removed (say when ToBeRemoved = true).
class SomeObj
ToBeRemoved be a boolean field
end class
It is more convenient to iterate backword the collection, getting the
element
DirectCast(SList.List.GetKey(i), SomeObj) and in case (say if
ToBeRemoved is true) to remove them with SList.List.RemoveAt(i) or to
rebuild the List taking only the ones not removed?
(In the latter case, a problem is that the list should not be recreated
using a New()
constructor, because it may be being used by other objects and one does
not want to disconnect the SList reference. )
How do I do this in the most efficient way?
-P
I have a sorted list with several thousands items. In my case, but this
is not important, objects are stored only in Keys, Values are all
Nothing. Several of the stored objects (might be a large number) have
to be removed (say when ToBeRemoved = true).
class SomeObj
ToBeRemoved be a boolean field
end class
It is more convenient to iterate backword the collection, getting the
element
DirectCast(SList.List.GetKey(i), SomeObj) and in case (say if
ToBeRemoved is true) to remove them with SList.List.RemoveAt(i) or to
rebuild the List taking only the ones not removed?
(In the latter case, a problem is that the list should not be recreated
using a New()
constructor, because it may be being used by other objects and one does
not want to disconnect the SList reference. )
How do I do this in the most efficient way?
-P