/// <summary> /// List all the media from media array /// </summary> public void listOfMediaObjects() { foreach (Media i in mediaArrayForObjects) { if (i == null) { break; } Type type = i.GetType(); Console.WriteLine("********************"); if (type.Name == "Book") { Console.WriteLine("*** BOOK ***"); Book book = (Book)i; book.showBooks(); } if (type.Name == "Movie") { Console.WriteLine("*** MOVIE ***"); Movie movie = (Movie)i; movie.showMovies(); } if (type.Name == "Song") { Console.WriteLine("*** SONG ***"); Song song = (Song)i; song.DisplaySong(); } } }
/// <summary> /// List all the songs from media array /// </summary> public void listOfSongs() { foreach (Media i in mediaArrayForObjects) { if (i == null) { break; } Type type = i.GetType(); if (type.Name == "Song") { Console.WriteLine("********************"); Song song = (Song)i; song.DisplaySong(); } } }