enumerating a hashtable

Results 1 to 2 of 2

Thread: enumerating a hashtable

  1. #1
    Join Date
    Dec 1969

    Default enumerating a hashtable

    the hashtable is a LIFO object. what is the best way to reverse it?<BR><BR>IEnumerator has three members: current, moveNext, and reset. i want to access the values in a FIFO sequence.<BR><BR>i considered enumerating the hashtable and copying all key-value pairs into a second hashtable, and then retrieving the values from the second hashtable. is there a better way to do this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default use a Queue

    Actually, a Hashtable is a key/value pair collection. I don&#039;t believe that the object order is guaranteed when enumerating through a Hashtable. It&#039;s also what is commonly refered to as an associative array. <BR><BR>If you need the key/value pair functionality, use a SortedList, which is a combination of an Array and a Hashtable (but once again, no guarantees on the order when enumerating).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts