- Home /
 
 
               Question by 
               unity_c3Z8hg6NHcx8OA · Dec 18, 2018 at 06:34 PM · 
                c#learning  
              
 
              Weird functioning lists
Im trying to change randomly some lists with the function mutate, except for the first two itens. In the output log it goes all right (the 'printGenotipo' is basically a func to print lists), but on the newPop var they change.
         newPop = new List<List<List<List<List<int>>>>>();
         int limit = 2;
         for (int i = 0; i < population.Count; i++)
         {
             if (i > limit-1)
             {
                 PrintGenotipo(Mutate(population[i].Genotipo));
                 newPop.Add(Mutate(population[i].Genotipo));
             }
             else
             {
                 PrintGenotipo(population[i].Genotipo);
                 newPop.Add(population[i].Genotipo);
             }
 
         }
 
              
               Comment
              
 
               
              Your answer