public void RemoveNotFit() { if (RemovePart <= 0.5) { var removeKeys = SortedMeals.Skip(KeepCount).ToList(); // first is best foreach (var key in removeKeys) { SortedMeals.Remove(key); } } else { var keepKeys = SortedMeals.Take(KeepCount).ToList(); // last is worst var newSortedKnapsacks = new OrderedBag <IMeal>(); foreach (var key in keepKeys) { newSortedKnapsacks.Add(key); } SortedMeals = newSortedKnapsacks; } }