private static void RecursiveLoopForMatch(List <IConferencePlannerTalk> items, IConferencePlannerTalk item, List <IConferencePlannerTalk> itemsCopy, int time) { AddRemoveItem(items, item, itemsCopy); var leftTime = time - items.Sum(i => i.DurationTime); if (leftTime > 0) { item = itemsCopy.OrderByDescending(o => o.DurationTime).FirstOrDefault(i => i.DurationTime <= leftTime); if (item != null) { RecursiveLoopForMatch(items, item, itemsCopy, time); } } }
private static void AddRemoveItem(List <IConferencePlannerTalk> items, IConferencePlannerTalk item, List <IConferencePlannerTalk> itemsCopy) { items.Add(item); itemsCopy.Remove(item); }
private void AddItem(IConferencePlannerTalk klaTalk) { Items.Add(klaTalk); }