Hi
How do you dynamically declare a type using an expression
for the identifier.

eg :

for x =1 to 10
Dim myObj+str(x) as object
next


Many thanks

Re: Declaring a type with identifier as an expression by Jon

Jon
Wed Aug 13 03:08:53 CDT 2003

Rabih <hadjtaieb@hotmail.com> wrote:
> How do you dynamically declare a type using an expression
> for the identifier.
>
> eg :
>
> for x =1 to 10
> Dim myObj+str(x) as object
> next

Generally, you don't - you use an array or map of some kind (such as
Hashtable) instead. Now, why do you particularly *want* to do it in
this case?

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Re: Declaring a type with identifier as an expression by Günter

Günter
Wed Aug 13 05:06:24 CDT 2003

You must use an array:

Dim myObj(10) As Object
myObj(1) = "Wert 1"
myObj(2) = "Wert 2"
Console.WriteLine(myObj(2)) 'Writes "Wert2" to the console


"Rabih" <hadjtaieb@hotmail.com> wrote in message
news:039101c36170$94d8bf50$a001280a@phx.gbl...
> Hi
> How do you dynamically declare a type using an expression
> for the identifier.
>
> eg :
>
> for x =1 to 10
> Dim myObj+str(x) as object
> next
>
>
> Many thanks