Esempio n. 1
0
        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";
            ViewData["Play"]    = "Play";
            SongArray sa = new SongArray();

            sa.array = new List <Song>();
            sa.array.Add(new Song("Rammst", 15));
            sa.array.Add(new Song("Prodigy", 5));
            sa.array.Add(new Song("Omen", 3));
            sa.array.Add(new Song("KiSh", 2));
            sa.array.Add(new Song("Leningrad", 1));


            return(View(sa));
        }
Esempio n. 2
0
        public static void TestIterator()
        {
            Console.WriteLine("------------Iterator------------");
            Song song1 = new Song("Jordan Rakei", "Eye to Eye");
            Song song2 = new Song("Billie Eilish", "Bad guy");
            Song song3 = new Song("Tom Misch", "Movie");
            Song song4 = new Song("Jordan Rakei", "Mad world");
            Song song5 = new Song("Jordan Rakei", "Cauliflower");

            Aggregate songsArray = new SongArray();

            songsArray.Add(song1);
            songsArray.Add(song2);
            songsArray.Add(song3);
            songsArray.Add(song4);
            songsArray.Add(song5);

            Aggregate songsList = new SongList();

            songsList.Add(song1);
            songsList.Add(song2);
            songsList.Add(song3);
            songsList.Add(song4);
            songsList.Add(song5);

            IIterator arrayIterator = songsArray.CreateIterator();

            Console.WriteLine("--------------Songs Array------------------");
            for (; arrayIterator.HasNext(); arrayIterator.Next())
            {
                Song song = arrayIterator.CurrentElement();
                Console.WriteLine(song.ToString());
            }

            IIterator listIterator = songsList.CreateIterator();

            Console.WriteLine("--------------Songs List------------------");
            for (; listIterator.HasNext(); listIterator.Next())
            {
                Song song = listIterator.CurrentElement();
                Console.WriteLine(song.ToString());
            }
            Console.WriteLine("----------------------------------");
        }