Exemple #1
0
 public void AddPopulations(List <Population> populations)
 {
     foreach (Population population in populations)
     {
         Population popMatch = Populations.FirstOrDefault(pop => pop.Race.NamePlural.Equals(population.Race.NamePlural, StringComparison.InvariantCultureIgnoreCase));
         if (popMatch != null)
         {
             popMatch.Count += population.Count;
         }
         else
         {
             Populations.Add(new Population(population.Race, population.Count));
         }
     }
     Populations = Populations.OrderByDescending(pop => pop.Count).ToList();
     Parent?.AddPopulations(populations);
 }
Exemple #2
0
 public void AddPopulations(List <Population> populations)
 {
     foreach (Population population in populations)
     {
         Population popMatch = Populations.FirstOrDefault(pop => pop.Race == population.Race);
         if (popMatch != null)
         {
             popMatch.Count += population.Count;
         }
         else
         {
             Populations.Add(new Population(population.Race, population.Count));
         }
     }
     Populations = Populations.OrderByDescending(pop => pop.Count).ToList();
     Parent?.AddPopulations(populations);
 }