No Hashtable.Get(key) method?

G

Guest

Hello,

I´m trying to implement a "reverse index table" using a hashtable.

But in the hashtable class i cannot find any get-Method.
The Java class of hashtable for example provides a method:
get(Object key)

Isn´t there any method in C# too?

If not... how to retrieve a value of a specific key?

And another question...

As I wrote, I have to implement a reverse index table.

This means that I have a class called "Document" and keys as int values.
I have to assign several Documents to one key. How would you do that to
get a most performant way?

My plan was to use a Hashtable in combination with a List.
Means I have int as keys for my Hashtable and putting my Document
objects into a List which I put into the Hashtable as value to a
specific key.

Is this a good idea?
I thought it very performant, because you can search very fast in a
Hashtable.



Regards,

Martin
 
G

Guest

Martin said:
But in the hashtable class i cannot find any get-Method.
The Java class of hashtable for example provides a method:
get(Object key)

Isn´t there any method in C# too?

C# support the syntax:

yourhastableobject[thekey]

Arne
 
G

Guest

Martin said:
This means that I have a class called "Document" and keys as int values.
I have to assign several Documents to one key. How would you do that to
get a most performant way?

My plan was to use a Hashtable in combination with a List.
Means I have int as keys for my Hashtable and putting my Document
objects into a List which I put into the Hashtable as value to a
specific key.

Is this a good idea?
I thought it very performant, because you can search very fast in a
Hashtable.

Hashtable of ArrayList is a known data structure.

Sounds OK to me.

If you are on .NET 2.0 then you should use Dictionary of List
ofcourse !

Arne
 

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

Top