Special hashtable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Boni

    #1

    Special hashtable?

    Dear all,
    I need a hashtable, where the value and the key is the same,or better said I
    need an array, where I can't add the same object 2 times. The access to
    elemts, which I need is only "for each element in Collection..."

    What is the best collection for that.

    I.e.
    MyCollection.ad d(oA1)
    MyCollection.ad d(oA2)
    MyCollection.ad d(oA3)

    But one more addition of the same object should fail,
    MyCollection.ad d(oA1) 'should throw an exception.

    The obvious workaround is dim MyCollection as Hashtable
    sub Add( arg)
    MyCollection(ar g,arg)
    end sub

    main
    Add(oA1)
    Add(oA2)
    Add(oA3)
    end

    Are there better solutions?


  • Chris Dunaway

    #2
    Re: Special hashtable?

    Look in the System.Collecti ons.Specialized namespace. There are
    probably some classes there that will fit your needs.

    Comment

    Working...