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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top