locked
Dynamically assign type of variable RRS feed

  • Question

  • Hi everybody,

    is it possible to declare a variable and to choose it's appropriate type during runtime?

    From the idea, it should be something like this (of course, the last line does not work):

    'Determine what type of variable is needed later    
    Dim myVariableType As System.Type = System.Type.GetType("System.String", True, True)
    
    'Create variable with needed type
    Dim myVariable As myVariableType ' Should be a string variable in this case

    Thank you,

    Feraud

    Saturday, May 15, 2010 1:45 PM

Answers

All replies