Bryce Marshall
9/28/2002 11:09:00 PM
That is because the underlying collection type in the DictionaryBase class
is a Hashtable. The sequence in which objects are stored in the underlying
array is determined by the hash code of the supplied key.
Try deriving your class from the
System.Collections.Specialized.NameObjectCollectionBase class.
Regards,
Bryce Marshall
"Azmodan" <azmodan@no_spam.ro> wrote in message
news:3D91A879.2000907@no_spam.ro...
> Hy,
> I inherited the DictionaryBase class in order to make myself a strong
> typed colletion, where i can store an object and a string key for it
> (like in VB6).
>
> But when I iterate trough the collection with foreach()
> the items I receive are not in the same order I've put them in.
> eg: I add obj0, obj1 and obj2 in this order and at foreach I get obj1,
> obj0, obj2. For a greater number of entries it almost looks random.
>
> What can i do? I need the items in the collection to be accesible by key
> and/or index.
>
> 10x,
> Azmodan
>