public class Song {
    public string Genre { get; protected set; }
    public string Name { get; protected set; }
    public string Band { get; protected set; }
    public Song(string name, string band, string genre) {
        Name = name;
        Genre = genre;
        Band = band;
    }
}
public interface IMusicVisistor
{
    void Visit(List<Song> items);
}
public class MusicLibrary {
    List<Song> _songs = new List<Song> { ...songs ... };
    public void Accept(IMusicVisitor visitor) {
        visitor.Visit(_songs);
    }
}
现在这是我做的一位访客:
public class RockMusicVisitor …