[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

c# - Reverse a HashList

Posted on 2007-10-10
2
Medium Priority
?
2,159 Views
Last Modified: 2013-11-26
HI,

How can I reverse a HashList?

I can convert it to ArrayList like this:

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

How can I convert it back to a Hashtable?

Thank you.
0
Comment
Question by:Endelm
2 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20049739
Well u mean something apart from iterating through the array list and creating the hashtables in a for loop.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 20049855
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.

See:
http://msdn2.microsoft.com/en-us/library/system.collections.hashtable.aspx

    "Represents a collection of key/value pairs that are organized based on the hash code of the key."
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 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