Q:

C# variable[#] in if statement where the # will be given later

I don't really know how to ask this question, my brain stopped.
I have some variables named tank1, tank2, tank3....
I want to use only one "if" statement with using the "tank" part of the variable and then adding its number after other actions.
if (tank + 1.ToString() > 5)
like it's
if (tank1 > 5)
Thanks.

A:

Use a List<Tank> if tanks are sequentially numbered with no gaps. You'll use it like:
    if(tanks[index] > threshold) // do whatever

Use a Dictionary<string, Tank> if there's no method to your naming madness. It will be used like this:
    if(tanks[key] > threshold) // do whatever

