old topic: ordered name/value pair class?

  • Thread starter Thread starter jason
  • Start date Start date
J

jason

this is an old topic, but i haven't found a clear answer. is there a
name/value class (such as dictionary or hashtable) that is either
ordered by FIFO, or sorted by key? either of those will work, so long
as the iterative sequence is deterministic.

i've tried hashtable, which isn't. and i read someone suggesting the
dictionarybase, but that isn't either. so can anyone tell me what to
use for a sorted or ordered name/value pair class?

thanks,

jason
 
jason said:
this is an old topic, but i haven't found a clear answer. is there a
name/value class (such as dictionary or hashtable) that is either
ordered by FIFO, or sorted by key? either of those will work, so long
as the iterative sequence is deterministic.

i've tried hashtable, which isn't. and i read someone suggesting the
dictionarybase, but that isn't either. so can anyone tell me what to
use for a sorted or ordered name/value pair class?

That's exactly what SortedList is. It's a shame it's so badly named,
but there we go...
 
ahh, yeah, i saw sorted list, but "list" made me immediately assume it
was single value. thanks!
 
Jon Skeet said:
That's exactly what SortedList is. It's a shame it's so badly named,
but there we go...

Wow, I never actually LOOKED at SortedList before.
I had assumed that used IComparer or something to determine ordering.
I am amazed that it is more like a Dictionary than a sorted ArrayList.

I guess that teaches me to Assume.

It really is badly named
Bill
 
Jon said:
That's exactly what SortedList is. It's a shame it's so badly named,
but there we go...

....and so badly implemented. Fortunately, both aspects are fixed in
2.0 with the SortedDictionary which is implemented with a balanced BST.
 
Back
Top