converting hashtable to arraylist

  • Thread starter Thread starter Alexander Widera
  • Start date Start date
A

Alexander Widera

hello,

how can I convert a hashtable to an arraylist or array? I want to sort the
hashtable... but this isn't posible, so i have to convert it to an
hashtable.

thank you,
alex
 
I see here one big problem:
1. HashTable is indexed with string key but ArrayList and Array have integer
indexer.
2. If you don't care about key in HashTable try this method:
HashTable.CopyTo(Array array, int arrayIndex)

The elements are copied to the Array in the same order in which the
enumerator iterates through the Hashtable.

To copy only the keys in the Hashtable, use Hashtable.Keys.CopyTo.

To copy only the values in the Hashtable, use Hashtable.Values.CopyTo.



http://msdn.microsoft.com/library/d...frlrfsystemcollectionshashtableclasstopic.asp
 
Back
Top