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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top