Exemplo n.º 1
0
        //Methods
        // Prints all the movies from the movieTable Dictionary to the ListBox
        public void printMovie(ListBox displayAll, MDatabase mD)
        {
            // foreach loop pulls KeyValuePair objects which have Key and Value properties
            // Data types must be specified for the key (int in this one) and value (Movie in this one)
            // Will output the year of the movie and the remaining values of the movie (Year, Title, Director) in the sorted list

            // mD.sortMovie(mD.MovieTable) is a method that will return a sorted List of type KeyValuePair<int,Movie>
            foreach (KeyValuePair <int, Movie> currentMovie in mD.sortMovie(mD.MovieTable))
            {
                displayAll.Items.Add("******************************");
                displayAll.Items.Add(currentMovie.Key.ToString());
                displayAll.Items.Add(currentMovie.Value.ToString());
            }
        }