PDA

View Full Version : Creating strongly typed array - Is this possible??



ChloeRadshaw
07-26-2009, 10:34 AM
Ok - So I normally always create a dictionary and then use the keys method to get an array - Heres an example



Dim dict as new dictionary
dict.add("abc", vbnull)
dict.add("def", vbnull)

Dim keys() as variant
keys = dick.keys()



Is there any way to specify the type of the array here - ie Dim abc as string().

If I did do this how would I then 'cast' the keys returned from the dictionary

I should say I come from a java background so this is the way I would do it in that language

Bob Phillips
07-26-2009, 10:55 AM
Why do you want to, it works does it not (when you get the syntax corrected)?

ChloeRadshaw
07-27-2009, 01:10 AM
Readbility / Structuring / Maintenance / Compiler support

All the things that a good programming language should do:)

ChloeRadshaw
07-27-2009, 01:11 AM
Why do you want to, it works does it not (when you get the syntax corrected)?
I take it - You cannot do this