public void ListEvents(DateTime date, int numOfEventsToShow) { string title = string.Empty; string location = string.Empty; OrderedBag <Event> .View eventsToShow = orderedByTitle.RangeFrom(new Event(date, title, location), true); int showedEvents = 0; foreach (var eventToShow in eventsToShow) { if (showedEvents == numOfEventsToShow) { break; } messages.PrintEvent(eventToShow); showedEvents++; } if (counter == 0) { messages.NoEventsFound(); } }