How to SOrt a HashTable In C#

  • Thread starter Thread starter RSB
  • Start date Start date
By it's definition, a hashtable is not a sorted collection. Perhaps you
should use another collection type.
 
RSB said:
How do i sort a Hash Table..

You could add the HashTable to an empty ArrayList, then sort the ArrayList:

public ICollection SortedHashTable(HashTable ht)
{
ArrayList sorter = new ArrayList();
sorter.AddRange(ht);
sorter.Sort();
return sorter;
}
 
Back
Top