Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SongCollection Class

SongCollection Class

A collection of songs in the song library.

Namespace: Microsoft.Xna.Framework.Media
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.

Dd282398.note(en-us,XNAGameStudio.41).gifNote

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

Community Additions

ADD
Show:
© 2015 Microsoft