The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaPropertySet.First | first method

Applies to Windows and Windows Phone

Returns an iterator to enumerate the items in the property set.


var iIterator = mediaPropertySet.first();


This method has no parameters.

Return value

Type: IIterator<IKeyValuePair>

The iterator. The current position of the iterator is index 0, or the end of the property set if the property set is empty.


The following example gets an instance of the MediaPropertySet class from the AudioEncodingProperties class and then gets an iterator for the property set. The example also shows how to use the other methods in the MediaPropertySet class.

function getPropertySet() { 
    var encodingProperties = new Windows.Media.MediaProperties.AudioEncodingProperties();
    var props =;
    // Remove all items from the property set.
    // Get an iterator for this property set. 
    var itertator = props.first();
    // Get the immutable view of the property set.
    var view = props.getView();   
    // Determine if the set has an item with the specified key.   
    if (props.hasKey(key)) {
        // Use the item.
    // Add an item with the specified key and value to the property set.    
    if (props.insert(key, value)) {
        // Value was replaced.
    else {
        // New key and value.
    // Get the value for the specified key.
    var value = props.lookup(key);
    // Remove the item with the specified key from the property set.
    // Get the number of items in the property set.
    var number = props.size;


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Media::MediaProperties [C++]



See also




© 2014 Microsoft