コード例 #1
0
        public static string ShowPlayListInfo()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine($"Songs added: {SongGenerator.PlayListCount()}")
            .AppendLine($"Playlist length: {SongGenerator.CalculatePlayListLenght()}");

            return(stringBuilder.ToString());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            int playListLenght = int.Parse(Console.ReadLine());

            for (int song = 0; song < playListLenght; song++)
            {
                try
                {
                    var songInfo = Console.ReadLine().Split(";", StringSplitOptions.RemoveEmptyEntries);
                    SongGenerator.CheckInputInfo(songInfo);

                    Song song1 = new Song(songInfo[0], songInfo[1], songInfo[2]);
                    Console.WriteLine("Song added.");

                    SongGenerator.AddSong(song1);
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            Console.WriteLine(Song.ShowPlayListInfo());
        }