View Single Post
Old 06-21-2004, 06:10 AM   #1 (permalink)
sammy
Code Monkey
 
sammy's Avatar
 
Join Date: Jun 2004
Location: Brooklyn/Rochester
Posts: 53
sammy is on a distinguished road
Send a message via AIM to sammy
Dynamic variables in C#?

Ok, the only way I can be really clear about this question is to put up a PHP example.

lets say i want to call the function func() on a whole bunch of variables, and they all are named in the following fashion: var1, var2, var3... etc

at compile time, i dont know how many of those variables i have. In php, its something like this:

for( $i = 0; $i < $theNumberOfVariables; $i++ ){
func( ${'var' . $i} );
}

is this possible in C#?
__________________
sammy is offline   Reply With Quote