我在寫一個處理歌曲的C#程序。我有一個Song類和一個繼承宋類型列表的SongCollection類。我需要編寫一個以藝術家(字符串)作爲參數的方法,並且我需要返回該藝術家的新SongCollection。我在訪問歌曲列表時遇到了一些困難。C#列表繼承
public SongCollection GetAllByArtist(string artist)
{
SongCollection newSongs = new SongCollection();
if (this.Artist == artist)
{
newSongs.Add(this.Song);
}
return newSongs;
}
在哪裏這種方法? (這是什麼?) – Sayse