title: c# creating multiple lists within for statement
body: <p>Is there a way I can create multiple lists under a "for" statement, with an incrimental naming system (eg monster1, monster2, monster3). I've flagged it up under <strong>this is where I want an incrimental name</strong> within the code.</p>
  
  <p>The number of lists needed to be generated is defined earlier on and I'm having no issues with that, but I'm getting "error CS0128: A local variable named `...' is already defined in this scope" if I attempt to assign the list name based on a variable with an inbuilt counter to incriment the list names (monsterList in this case).</p>
  
  <p>Is there another way I can do this, so that no matter how many lists I need to be generated, it will create them and name them following this set pattern?</p>
  
  <p>The below code is what I'm looking to have iterate a nuber of times (I'm new, so it's probably horribly inefficient, I'm just trying to get it doing what I want for now!):</p>
  
  <pre><code>for (int monstCounter = 2; monstCounter &lt; totalTimes; monstCounter++) 
            {
  Console.WriteLine();
  string monsterLists = "Monster " + monstCounter;
  string monsterList = "monsters"+monstCounter;
  Console.WriteLine(monsterLists);
      p = 0;
      foreach (Monster aMonster in monsters)
      {
        if (monsters[p].MonsterName == monsterLists)
        y = p;
        p++;
      }
      y = monsters[y].MonsterPopu;
  
      //Create a list of individuals.
      List&lt;MonsterStatistics&gt; **This is where I want an incrimental name** = new List&lt;MonsterStatistics&gt;();
        totalTimes1 = y;
        counter1 = 1;
          for (int b=0; b &lt; totalTimes1; b++) 
            {
  
      // Add monsters to the list.
        monsterList.Add(new MonsterStatistics() {oldAge = rndNum.Next(1,100), name = "Name"+counter1, coupled = false, genderGen = rndNum.Next(0,2)}); 
      counter1++;
  }  
  
  foreach (MonsterStatistics aMonster in monsterList){
            if(aMonster.genderGen == 0)
            aMonster.gender = "Male";
            else if (aMonster.genderGen == 1)
            aMonster.gender = "Female";
            else 
            aMonster.gender = "Genderless";
  aMonster.age = rndNum.Next(0,aMonster.oldAge);
  Console.WriteLine(aMonster.name + " Age: " + aMonster.age + "/" + aMonster.oldAge + " " + aMonster.gender);
  }
  }
  </code></pre>