Exemplo n.º 1
0
        public void Add(Mp3File file)
        {
            if (file.Artist != Name)
            {
                throw new ArgumentException($"{file} cannot be added to artist {this}. It is by {file.Artist}.");
            }

            if (!_albums.TryGetValue(file.Album, out Album album))
            {
                album = new Album(file.Album);
                _albums.Add(file.Album, album);
            }
            album.Add(file);
        }
Exemplo n.º 2
0
        public void Add(Mp3File file)
        {
            if (!_albums.TryGetValue(file.Album, out Album album))
            {
                album = new Album(file.Album);
                _albums.Add(file.Album, album);
            }
            if (!_artists.TryGetValue(file.Artist, out Artist artist))
            {
                artist = new Artist(file.Artist);
                _artists.Add(file.Artist, artist);
            }

            album.Add(file);
            artist.Add(file);
        }