/// <summary> /// Raises an IndexError if there is no artist with the given ID in the playlist of the channel. /// </summary> /// <param name="p_iID">The ID of the desired artist.</param> /// <returns>A RainwaveArtist for the given artist ID</returns> public RainwaveArtist getArtistByID(int p_iID) { RainwaveArtist rwArtist = null; if (!ArtistExists(p_iID, out rwArtist)) { throw new KeyNotFoundException("A RainwaveArtist for the given artist ID does not exist."); } return(rwArtist); }
private bool ArtistExists(int p_iID, out RainwaveArtist rwArtist) { rwArtist = null; foreach (RainwaveArtist rwA in Artists) { if (rwA.iID == p_iID) { rwArtist = rwA; return(true); } } return(false); }