I have a number of variables such as
int foo1;
int foo2;
int foo3;
int foo4;
Now, I have a for loop, going from var x = 0 to 3 (for the 4 variables), and i would like to use x to call the variables like this:
for(int x = 0; x < 4; x++)
{
foo+x = bar;
}
so that when x = 1, then my variable foo1 will be assigned the value bar (foo+x = bar == foo1 = bar when x = 1).
Is there any way of doing this in C# or should I take an alternative approach?
int[]) or aList<int>instead.