C# Developers' Journal (original) (raw)

3:09p

Hello.. Is there a way to dynamically decide variable names? Like..
Assuming the declaration

int var1, var2, var3;

Say I want to set all these with a value of 1 with a loop.

for(int i = 1; i <= 3; i++){
var{i} = 1;
}

?? Is this do-able?

(10 Comments |Comment on this)