clearing a read-only collection

  • Thread starter Thread starter ChrisB
  • Start date Start date
C

ChrisB

Hello:

I have created a collection that inherits from ReadOnlyCollectionBase and
was wondering if there is a way to clear the items in the collection from
within a method of the collection (of course, this.Clear() is invalid for
read-only collections).

Any suggestions?

Thanks!
Chris
 
Chris,

You should be able to call the Clear method on the ArrayList exposed
through the protected InnerList property.

Hope this helps.
 
That's what I was looking for.

Thanks!
Chris

Nicholas Paldino said:
Chris,

You should be able to call the Clear method on the ArrayList exposed
through the protected InnerList property.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

ChrisB said:
Hello:

I have created a collection that inherits from ReadOnlyCollectionBase and
was wondering if there is a way to clear the items in the collection from
within a method of the collection (of course, this.Clear() is invalid for
read-only collections).

Any suggestions?

Thanks!
Chris
 
Back
Top