Hello, I have a situation where all of my code is the same aside from which lists are used in a for statement. How can I determine which list to use and swap it with a single variable?
Example:
(Before)
switch (ListType)
{
case 0:
for (int x = 0; x < ListA.Count; x++)
{
}
case 1:
for (int x = 0; x < ListB.Count; x++)
{
}
case 2:
for (int x = 0; x < ListC.Count; x++)
{
}
}
(After)
for (int x = 0; x < SelectedList.Count; x++)
{
}
(all lists are the same length)