473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

clearing a read-only collection

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

Nov 17 '05 #1
2 3888
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]
- mv*@spam.guard.caspershouse.com

"ChrisB" <pl****************@thanks.com> wrote in message
news:OM**************@tk2msftngp13.phx.gbl...
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

Nov 17 '05 #2
That's what I was looking for.

Thanks!
Chris

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:u8**************@tk2msftngp13.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"ChrisB" <pl****************@thanks.com> wrote in message
news:OM**************@tk2msftngp13.phx.gbl...
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gary | last post by:
I have a problem with the datagrid not clearing when the datasource changes, a few fields remain on the screen and even when new data would fill those grid squares the old data remains. I wind...
6
by: Carol Pedder | last post by:
Hello all, may I ask a question? Having just started C++ (using microsoft visual studio), I am using cin/cout for console applicarions (yes I know it doesn't happen in the real world!) and I'm...
2
by: Andrey Tarasevich | last post by:
Hello Consider the following HTML code sketch <div> <img src="..." style="float: left"> <p>Paragraph text</p> </div> <hr>
14
by: Jason | last post by:
Hi. I have a structure that was used in a previous iteration of a loop, and I want to clear out all the structures values that the previous iteration assigned without assigning every variable to...
2
by: Peter Bailey | last post by:
I have a function courtesy of the newsgroup that clears the list box. I would like to now set the listbox back to its initial state where you can see the first item in the list. The same goes for a...
4
by: Roubles | last post by:
Hi All, Quick question; what is the difference between initializing and clearing a structure like this: mystruct_t a = {0}; and initializing and clearing it like this:
18
by: JG | last post by:
Does anyone know a standard (or supported on Linux, Mac, Win32) way to clear a read stream buffer (standard ANSI C file stream)? I would even settle for a platform specific way of doing it. ...
0
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new...
9
by: Werner Hempel | last post by:
Hello, I'm trying to do a simple three column layout, with two divs (#left and #right) floating left and right, and the #content-div with margins in between, and all three in a wrapper-div. The...
9
by: kardon33 | last post by:
Hi all, What i am trying to accomplish is take in a list of IP addresses from a text file (each Ip is on a new line). I got my program mostly working except when an IP address is longer than...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.