Manipulating HashTables

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)
 
S

Steve C. Orr, MCSD

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top