次の方法で共有


SongCollection Class

A collection of songs in the song library.

Namespace: Microsoft.Xna.Framework.Media
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public sealed class SongCollection : IEnumerable<Song>, IEnumerable

Remarks

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.

Note

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.

See Also

Reference

MediaLibrary.Songs Property
Album.Songs Property
Artist.Songs Property
Genre.Songs Property
Song Class
SongCollection Members
Microsoft.Xna.Framework.Media Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista, Zune