need some direction, how do you create a collection that supports the following:

Discussion in 'ASP .Net' started by dx, Mar 25, 2005.

  1. dx

    dx Guest

    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
     
    dx, Mar 25, 2005
    #1
    1. Advertising

  2. dx

    dx Guest

    My apologies for the double post. Outlook express crapped out when posting
    this message the first time.

    stan


    "dx" <> wrote in message
    news:AaZ0e.7951$...
    > 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
    >
    >
    >
    >
    >
     
    dx, Mar 25, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dx
    Replies:
    1
    Views:
    363
    Lucas Tam
    Mar 25, 2005
  2. Øyvind Isaksen
    Replies:
    1
    Views:
    1,037
    Øyvind Isaksen
    May 18, 2007
  3. Replies:
    0
    Views:
    297
  4. Hemant

    create collection of collection

    Hemant, Oct 22, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    436
    Gregory A. Beamer
    Oct 22, 2009
  5. Oscar Gonzalez
    Replies:
    14
    Views:
    226
    Steve Litt
    Dec 9, 2005
Loading...

Share This Page