Hal,
Consider using a System.Collecti ons.SortedList instead of a HashTable.
The SortedList represents "a collection of key-and-value pairs that are
sorted by the keys and accessible by key and by index". In other words its
an ordered HashTable.
Unfortunately the SortedList will only get sort the keys & not the values.
If you want sorted values, I would put all the values into an ArrayList,
then sort the ArrayList in descending order (using a custom IComparable
object). If my app needed to "repeatedly " do this sort I would consider
creating a custom collection that maintained both the index (the descending
value arraylist) and the original hashtable...
Post if you need samples.
Hope this helps
Jay
"Hal Heinrich" <Ha*********@di scussions.micro soft.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
Hi,
I have a hastable with key/value pairs. I want to iterate thru the
collection in descending order by value. What is the 'best practice' for
handling this problem?
Thanks in advance for your help,
Hal Heinrich
VP Technology
Aralan Solutions Inc.