Clearing CollectionBase derived list

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

I have two lists, the first is the complete list, so call it PermList, the
second is a subsection of that list, call this TempList, both are of the
same type, naemly strongly typed and derived from CollectionBase.

I assume that if I simply iterate thro the PermList list taking the elements
that I want and simply add them to TempList then, when I want to clear the
TempList in order to add the next subsection from PermList, by simply doing
TempList.Clear will only clear the pointers to the object from TempList
leaving them intact in PermList?

Is this true?

TIA
Colin
 
Hi,

I have two lists, the first is the complete list, so call it PermList, the
second is a subsection of that list, call this TempList, both are of the
same type, naemly strongly typed and derived from CollectionBase.

I assume that if I simply iterate thro the PermList list taking the elements
that I want and simply add them to TempList then, when I want to clear the
TempList in order to add the next subsection from PermList, by simply doing
TempList.Clear will only clear the pointers to the object from TempList
leaving them intact in PermList?

Is this true?


Yep. Or TempList = null or TempList = new TempListType() will do the same
thing.
 
Back
Top