private static void DisplayMoviesByCategory(string category) { MovieList.Sort(new MovieCompare()); foreach (Movie movie in MovieList) { if (movie.Category.Equals(category)) { Console.WriteLine(movie.Title); } } }
static void Main(string[] args) { MovieList movieListClass = new MovieList(); Console.WriteLine("Welcome to the Movie List Application!\n\nThere are over 100 movies in this list!"); while (true) { Categories category = (Categories)Enum.Parse(typeof(Categories), Validator.promptUser("What category are you interested in?\n1=Animated\n2=Drama\n3=Horror\n4=Science Fiction\n", (str => Enum.TryParse(str, out category)))); Console.WriteLine(""); foreach (Movie movie in movieListClass.getMovieList(category.ToString())) { Console.WriteLine($"{movie.GetTitle()} from {movie.GetYear()}"); } Console.WriteLine(""); if (Validator.promptContinue()) { break; } Console.Clear(); } }