Class SongCollection
A collection of songs in the song library.
public class SongCollection : ICollection<Song>, IEnumerable<Song>, IEnumerable, IDisposable
- Inheritance
-
SongCollection
- Implements
- Inherited Members
Remarks
The SongCollection class provides access to songs in the device's song library.
Use the 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;
Fields
Empty
Returns a SongCollection with no contents.
public static readonly SongCollection Empty
Field Value
Properties
Count
Gets the number of Song objects in the SongCollection.
public int Count { get; }
Property Value
IsReadOnly
Gets whether this collection is read-only,
public bool IsReadOnly { get; }
Property Value
this[int]
Gets the Song at the specified index in the SongCollection.
public Song this[int index] { get; }
Parameters
index
int
Property Value
Methods
Add(Song)
Adds a Song to this SongCollection.
public void Add(Song item)
Parameters
item
Song
Clear()
Removes all items from this SongCollection.
public void Clear()
Clone()
Creates a new object that is a copy of the current instance.
public SongCollection Clone()
Returns
- SongCollection
A new object that is a copy of this instance.
Contains(Song)
Determines whether a Song is in the SongCollection
public bool Contains(Song item)
Parameters
item
Song
Returns
- bool
true if
item
is found in the SongCollection; otherwise, false.
CopyTo(Song[], int)
public void CopyTo(Song[] array, int arrayIndex)
Parameters
array
Song[]The one-dimensional Array that is the destination of the elements copied from collection. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in array at which copying begins.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Song> GetEnumerator()
Returns
- IEnumerator<Song>
An enumerator that can be used to iterate through the collection.
IndexOf(Song)
Searches for the specified Song and returns the zero-based index of the first occurence within the entire SongCollection.
public int IndexOf(Song item)
Parameters
Returns
- int
The zero-based index of the first occurence of
item
within the entire SongCollection, if found. otherwise, -1.
Remove(Song)
Removes the first occurrence of a Song from the SongCollection.
public bool Remove(Song item)
Parameters
item
SongThe object to remove from the SongCollection.
Returns
- bool
true if item was successfully removed from the SongCollection; otherwise, false. This method also returns false if item is not found in the original SongCollection.