Manipulating HashTables

  • Thread starter Thread starter Andrew Sweetman
  • Start date Start date
A

Andrew Sweetman

Hi everybody,

Does anyone know how to get the key of the last item added to a hashtable?

Many thanks,

Andy. (ASP.NET virgin, ready for sacrifice)
 
I don't believe the hashtable stores that information (the order in which
items were inserted.)
If you're using VB.NET the built in collection class should give you the
functionality you desire:
http://msdn.microsoft.com/library/d.../html/vbconthevisualbasiccollectionobject.asp

If you're using C# you'll probably have to do things the hard way (as
usual.) You might consider inheriting from the hashtable to add this
functionality.
Here's more info:
http://msdn.microsoft.com/library/d...frlrfsystemcollectionshashtableclasstopic.asp

Or maybe another kind of collection class might work out better for you.
Perhaps a Queue?
Here's more info:
http://msdn.microsoft.com/library/d...y/en-us/cpref/html/frlrfsystemcollections.asp
 
Back
Top