Suppose I have a list of objects
List DogList = new List();
and I want to automatically add objects to it, li
If you don't need them to have a name you could try this.
DogList.Add(new dogClass());
Otherwise you can't dynamically name variables like that. However, you could use a dictionary to associate the string "myDog1" etc to a value.
for (int i = 0; i < 10; i++)
{
dogClass myDog = new dogClass();
DogList.Add(myDog);
}