Hashtable

  • Thread starter Thread starter juli jul
  • Start date Start date
J

juli jul

Hello,
I have an array (of objects) and I want that each entry in array will be
a key in my hashtable.(not with foreach but in one action).
Which method I should use for this?
Thanks!
 
I could not understand your question clearly. But if i undestand exactly
what u mean. U have a list of objects want to use a hashtable for some
records (not all).

One advice u, to store all list in the hashtable. Hashtable should contain
all data and map a null reference for nonexisting ones..

Anohter approach is storing a hashtable and a list. Hashtable or arraylist
should contain record. Not both of them..

It is a design issue, so it depends on really what u want to do...

--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET
 
juli said:
Hello,
I have an array (of objects) and I want that each entry in array will be
a key in my hashtable.(not with foreach but in one action).
Which method I should use for this?

You can't do that. What wrong with the iteration? Besides, what would
the corresponding values in the hash be?

IDictionary d = new Hashtable(array.Length);
foreach ( object o in array )
d.Add(o, a_value(o));
 
Back
Top