private static List <PickedMeal> RearangeList(List <Meal> newList) { List <PickedMeal> pickedMealList = new List <PickedMeal>(); foreach (Meal meal in newList) { PickedMeal selectedPickedMeal = null; foreach (PickedMeal pMeal in pickedMealList) { if (pMeal.Name == meal.Name) { selectedPickedMeal = pMeal; break; } } if (selectedPickedMeal == null) { // 메인은 통계적인 정보를 보여주는 건데, 개별 아이템에 날짜/type 정보를 보여주기 애매해서 일단 첫번째 데이터로 뿌려줌 pickedMealList.Add(new PickedMeal(meal.Name, meal.Rate, meal.ImageName, meal.CreateDate, meal.Comments, meal.Type)); } else { selectedPickedMeal.AddRate(meal.Rate); selectedPickedMeal.AddCount(); selectedPickedMeal.SetComments(meal.Comments); // 제일 긴걸로 넣어준다. } } return(pickedMealList); }