My problem is this:
I need to list several lists, but the list numbers are unrecognizable. And all item numbers in each list are also unrecognizable. Sicne I would like to go through all combinations of list items, for example: 1) select A from list 1, A from list 2, A from list 3; 2) ick A from list 1, A from list 2, B from list 3 ... to rearrange ALL.
I use inested for-loop to move, for example, if I have two lists, then:
for (int i = 0; i < list[0].EnergyParameters.ListEnergyLevelCandidates.Count; i++)
{
for (int j = 0; j < list[1].EnergyParameters.ListEnergyLevelCandidates.Count; j++)
{
}
}
If I have three lists, then:
for (int i = 0; i < list[0].EnergyParameters.ListEnergyLevelCandidates.Count; i++)
{
for (int j = 0; j < list[1].EnergyParameters.ListEnergyLevelCandidates.Count; j++)
{
for (int k = 0; k < list[2].EnergyParameters.ListEnergyLevelCandidates.Count; k++)
{
}
}
}
Since the list numbers are unrecognizable, therefore, the number of slots is unrecognizable, which means that I do not know how many levels of the for loop should be written.
Within this kind of circumstance, how can I write code for dynamic levels for a loop? I do not want to write 10 cycles for 10 lists.