I need some direction, how to create a collection that allows the following:

D

dx

I'd appreciate some ideas or direction with a collection issue.

I need to create a custom collection that inherits ICollection, IEnumberable
(need to be able to access by key, index and be able to enumerate) and this
is the kicker...should be able to define the location (index) when inserting
a new item (like arraylist allows.) The real challenge here is being able to
specify the index or where the item will appear when enumerating thru the
collection. I have the rest working by inheriting from
NameObjectCollectionBase.

My problem stems from an object collection I'm using. This collection is
initially instantiated and loaded with items in a specific order. This
object remains in memory, a user can add a new item to the collection after
it is initially loaded. When the user adds a new item (object) to the
collection, the item always appears as the last item when enumerating thru
the collection... which I do not want. I want to be able to specify where
the new item will be placed when enumerating thru this collection.

Is it possible to inherit ArrayList and incorporate the IDictionary
interface? Any ideas on how to do this?

Thanks in advance for any potential help you can provide.

stan
 
L

Lucas Tam

dx said:
Is it possible to inherit ArrayList and incorporate the IDictionary
interface? Any ideas on how to do this?

Don't one of these classes have an INSERT function? You could do something
similar - allow the user to insert a new element by index.
 

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

Top