public void ListMoviesFromDirector(string director) { IEnumerable <IMovie> mList = director == null?_finder.FindAll() : _finder.FindByDirector(director); foreach (var movie in mList) { Console.WriteLine(movie.Name + " by " + movie.Director); } }
/// <summary> /// Returns a list of those movies directed by the supplied /// <paramref name="director"/> /// </summary> /// <param name="director"> /// The name of the director whose movies we are to return. /// </param> /// <returns> /// A list of those movies directed by the supplied /// <paramref name="director"/>. /// </returns> public Movie [] MoviesDirectedBy(string director) { IList allMovies = _movieFinder.FindAll(); IList movies = new ArrayList(); foreach (Movie m in allMovies) { if (director.Equals(m.Director)) { movies.Add(m); } } return((Movie [])ArrayList.Adapter(movies).ToArray(typeof(Movie))); }
public Movie[] MoviesDirectedBy(string director) { List <Movie> result = new List <Movie>(); List <Movie> allMovies = _finder.FindAll(); foreach (Movie movie in allMovies) { if (movie.Director.Equals(director)) { result.Add(movie); } } return(result.ToArray()); }
public Movie[] MoviesDirectorBy(string name) { var allMovies = _movieFinder.FindAll(); var it = allMovies.GetEnumerator(); while (it.MoveNext()) { var movie = (Movie)it.Current; if (movie.GetDirector() != name) { allMovies.Remove(movie); } } return((Movie[])allMovies.ToArray()); }
public IEnumerable <Movie> MoviesDirectedBy(string arg) => finder.FindAll().Where(movie => movie.Director == arg);
public Movie[] GetMPG() { var allMovies = _movieFinder.FindAll(); return(allMovies.Where(m => m.Name.EndsWith(".MPG")).ToArray()); }
public IList <Movie> MoviesDirectedBy(string arg) { return(movieFinder.FindAll()); }