c# - Reverse a HashList

Posted on 2007-10-10
Last Modified: 2013-11-26

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.
Question by:Endelm
    LVL 21

    Expert Comment

    Well u mean something apart from iterating through the array list and creating the hashtables in a for loop.
    LVL 85

    Accepted Solution

    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."

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now