Hashtable - array as value

  • Thread starter Thread starter mj.clift
  • Start date Start date
M

mj.clift

Hi All,

Is it possible to have the value of a hashtable key set as an array.
Then look up the value for that key and have it return a random value
from that array?

Thanks,

Calvin
 
Calvin,

You could definitely do that. Just get the array from the Hashtable
(use a Dictionary<TKey, TValue> in .NET 2.0).

Then, you can use the Random class to pick an element from the array.

Hope this helps.
 
Hi Nicholas,

Thanks for the help, but as I'm such a beginner I'm not sure of how to
go about even that... at the moment when I look up the array value for
a key I get system.collection. Could you show me how it's done?

Thanks,

Calvin
 
Back
Top