A collection of songs in the song library.
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
public sealed class SongCollection : IEnumerable<Song>, IEnumerable, IDisposable
The SongCollection class provides access to songs in the device's song library.
Use the MediaLibrary.Songs property to obtain the following collections:
- All songs in the media library.
- Songs on a particular album.
- Songs associated with a particular artist.
- Songs associated with a particular genre.
The SongCollection does not immediately instantiate instances of all songs in the collection. Instead, individual Song objects are created each time a user accesses a song through the collection's Item indexer. See the Remarks section of Item for the resource implications of maintaining references to multiple Song objects.
All of the collections, playlists, and queues returned by methods and properties in the Microsoft.Xna.Framework.Media namespace are immutable. You cannot add or remove objects from those collections or playlists. To create a custom 'playlist' of songs, games must maintain their own list of songs to play, and play those songs one at a time by calling MediaPlayer.Play.
Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone