c# - Reverse a HashList


How can I reverse a HashList?

I can convert it to ArrayList like this:

Hashtable catagoryTable = new Hashtable();
ArrayList entries = new ArrayList(catagoryTable)

How can I convert it back to a Hashtable?

Thank you.
Who is Participating?
Mike TomlinsonMiddle School Assistant TeacherCommented:
To what end?!...

The insertion order of entries in a HASHTABLE is NOT preserved.

Entries in a HashTable are internally "ordered" based upon the Hash of each key.  So as you enter items, the order changes based on what it is doing internally with the keys to make lookups...

You, as the end user, have NO control over the order of entries in a HashTable.


    "Represents a collection of key/value pairs that are organized based on the hash code of the key."
Well u mean something apart from iterating through the array list and creating the hashtables in a for loop.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.