Skip to main content
PropertySet class

Represents a property set, which is a set of PropertyValue objects with string keys.


var propertySet = new Windows.Foundation.Collections.PropertySet();

public sealed class PropertySet : IPropertySet,
    IObservableMap<String, Object>,
    IDictionary<String, Object>,

Public NotInheritable Class PropertySet
    Implements IPropertySet, _
    IObservableMap(Of String, Object), _
    IDictionary(Of String, Object), _
    IEnumerable(Of KeyValuePair)

public ref class PropertySet sealed : IPropertySet,
    IObservableMap<String, Object>,
    IMap<String, Object>,


The PropertySet class has these types of members:


The PropertySet class has these constructors.

PropertySet Creates and initializes a new instance of the property set.



The PropertySet class has these events.

MapChanged Occurs when the observable map has changed.



The PropertySet class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

Add(KeyValuePair) [C#, VB]Adds a new key-value pair to the PropertySet.
Add(String) [C#, VB]Adds an item to the PropertySet.
Clear Removes all items from the property set.
Contains [C#, VB]Returns a value that indicates whether a specified key-value pair exists in the PropertySet.
ContainsKey [C#, VB]Returns a value that indicates whether a specified key exists in the PropertySet.
CopyTo [C#, VB]Copies the elements of the collection to an array, starting at a particular array index.
First [C++, JavaScript]Returns an iterator to enumerate the items in the property set.
GetView [C++, JavaScript]Gets an immutable view of the property set.
HasKey [C++, JavaScript]Indicates whether the property set has an item with the specified key.
Insert [C++, JavaScript]Adds an item to the property set.
Lookup [C++, JavaScript]Retrieves the value for the specified key.
Remove [C++, JavaScript]Removes an item from the property set.
Remove(KeyValuePair) [C#, VB]Removes a specific key-value pair from the PropertySet.
Remove(String) [C#, VB]Removes a specific item from the PropertySet.
TryGetValue [C#, VB]Returns a value that indicates whether a specified key exists in the PropertySet. If an item with that key exists, the item is retrieved as an out parameter.



The PropertySet class has these properties.

PropertyAccess typeDescription

Count [C#, VB]


Gets the number of elements contained in the collection.

IsReadOnly [C#, VB]


Gets a value indicating whether the dictionary is read-only.

Item [C#, VB]


Gets or sets the element value at the specified key index.

Keys [C#, VB]


Gets an ICollection object containing the keys of the PropertySet.

Size [C++, JavaScript]


Gets the number of items contained in the property set.

Values [C#, VB]


Gets an ICollection object containing the values of the PropertySet.



This class implements a map (the IMap<K,V> interface) with keys of type String and values of type PropertyValue. The PropertySet type enables various Windows Runtime APIs to return a collection of mixed values that can still be iterated or inspected using the common collection APIs of PropertySet, which match those of IMap<K,V>, IDictionary<TKey,TValue>, or JavaScript collection and enumeration techniques, depending on which language your app uses.

PropertyValue is a class that supports a large number of static Create* methods that create a deliberately untyped value from an input that's typically a value type or primitive (Boolean, numbers and so on) or an array of those values. Once one of the static PropertyValue methods is called, its return value can be treated as a PropertyValue instance (however the Create*methods technically return an Object if you look at the signatures).

However, you don't typically use a PropertySet in a way that requires you to fill the PropertyValue values in the set yourself. Instead, you typically get a filled-in PropertySet as a return value from a Windows Runtime API that's providing a collection where the value types within it might be mixed, but are still related to each other by origin or scenario. For example, the LocalSettings and RoamingSettings values that you get when you retrieve app data are of type ApplicationDataContainer, and each contains a PropertySet as its Values property value. When you interact with app data that's storing settings, you typically get the collection from ApplicationDataContainer.Values. Then you can:

For scenarios like working with app data, when you have a PropertySet you have it by reference, so if you add items to the PropertySet using Add/ Insert these items will be added to the app data, and removing items removes them from app data. All such changes are then shared through the app data mechanisms, if they're made to the RoamingSettings.

There are other Windows Runtime APIs that use a PropertySet value as a direct value rather than wrapped in another class like ApplicationDataContainer. For example, CoreApplication.Properties returns a PropertySet.

Various properties that report info from media and devices use PropertySet, for example PlayToReceiver.Properties. However, there are other media/devices property sets that don't use PropertySet and instead use MediaPropertySet, because the identifier for those properties is better represented when keyed as a GUID rather than a string.

In many cases where a Windows Runtime API uses a PropertySet as a value, it's actually shown as IPropertySet in the signatures. PropertySet can be considered the practical implementation of IPropertySet that's ready for use by app code. JavaScript code can treat any IPropertySet value as if it implemented the PropertySet prototypes.

Collection member lists

For JavaScript, PropertySet supports using an index to access items.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.FoundationContract, introduced version 1.0


Windows::Foundation::Collections [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8


Windows::Foundation::Collections [C++]




[ DualApiPartition()]
[ MarshalingBehavior(Agile)]
[ Threading(Both)]
[ Version(0x06020000)]

See also

IObservableMap(String, Object)
IMap(String, Object)
Windows.Foundation.PropertyValue class
IPropertySet interface