Home All Groups Group Topic Archive Search About

Re: Strict type for Hashtable?

Author
14 Jul 2006 9:16 AM
Larry Lard
Shane wrote:
> I thought that arrays and hash tables could be strictly typed under 2.0
> instead of just being objects, but I can't find any documentation.
>
> I want to have the values in a hash table designated as a string type,
> so that I don't have to keep doing  something like:
>
> strSomething = CStr(hashtable(Key))
>
> I'd rather have
> strSomething = hashtable(Key)
>
> Do the hashtables support this? If they do, what is the syntax?

The class you are looking for is Dictionary(Of TKey, TValue). This is a
better name than 1.x's 'Hashtable', because Dictionary is the
_concept_, whereas Hashtable is just one particular _implementation_.
You can find an example of its use here:

<http://msdn2.microsoft.com/en-us/library/xfhwa508.aspx>

--
Larry Lard
Replies to group please

Author
14 Jul 2006 3:05 PM
Shane
Thanks for the info guys.

This feature was one of the items that had me chomping at the bit to
upgrade to 2.0

Shane