public static IPlaylistSong ToPlaylistSong <T>(this SongFeedReaders.Data.ISong song) where T : IPlaylistSong, new() { if (song == null) { throw new ArgumentNullException(nameof(song), "ScrapedSong cannot be null for ToPlaylistSong()"); } return(new T() { Hash = song.Hash, Name = song.Name, Key = song.Key, LevelAuthorName = song.LevelAuthorName }); }
public static IPlaylistSong?Add <T, TSong>(this T playlist, SongFeedReaders.Data.ISong song) where T : IPlaylist <TSong>, new() where TSong : IPlaylistSong, new() { if (song == null) { throw new ArgumentNullException(nameof(song), "ScrapedSong cannot be null for ToPlaylistSong()"); } TSong pSOng = new TSong() { Hash = song.Hash, Name = song.Name, Key = song.Key, LevelAuthorName = song.LevelAuthorName }; return(playlist.Add(pSOng)); }