Special hashtable?

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

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.add(oA1)
MyCollection.add(oA2)
MyCollection.add(oA3)

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

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

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

Are there better solutions?
 
Look in the System.Collections.Specialized namespace. There are
probably some classes there that will fit your needs.
 
Back
Top