How do I create a new list without statically supplying a name for it?

I have a list of numbers. The list can vary from 1 to 200. I also have an array of game objects. Each of the game objects have a variable named wall that is an int.

My goal is to sort each of the game objects in to a new list based on the wall number they have.

The problem I am running in to is list creation. I do not have a set number of lists that need to be created. It could be anywhere from 1 to 200. I can’t figure out how to declare a new list without statically providing it with a name. How can I programmatically name a list?

Not sure I understand everything right… Are you looking for a list of lists?

using System.Collections.Generic;

List<List<int>> listOfListsOfInt = new List<List<int>>();

List<int> aList;

aList = new List<int>();
aList.Add(1);
aList.Add(3);
aList.Add(5);
listOfListsOfInt.Add(aList);

aList = new List<int>();
aList.Add(2);
aList.Add(4);
aList.Add(6);
listOfListsOfInt.Add(aList);

It sounds like what you are looking for is nested lists. i.e. a list of lists.

List<List<int>> myList = new List<List<int>>();

You can then add or remove lists to this list as you normally would.

myList.Add(new List<int> { 2, 5, 1, 3});

If you want to use a string to name the lists you can use a dictionary of lists instead.