IPropertySet interface

IPropertySet interface

Represents a collection of key-value pairs, correlating several other collection interfaces.


public interface IPropertySet : IObservableMap<String, Object>, 
    IDictionary<String, Object>, IEnumerable<KeyValuePair>


The IPropertySet interface does not define any members.


This interface is unusual in that it doesn't define any new members. Instead, it correlates three other collection interfaces such that they share the same type parameter constraints:

If you cast an object to IPropertySet (which isn't a generic) you can then use the combined methods of these three interfaces based on using String for key, Object for value. For a practical implementation, Windows Runtime uses the PropertySet class. See the documentation for various members of PropertySet to learn how to use those methods once you cast as IPropertySet.

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. Usage by type is the main scenario for IPropertySet; actually implementing the interface in your app code is less common.

IPropertySet is also implemented by the ValueSet class. ValueSet is the value type of several ContinuationData properties, which enable restoring state when apps resume after calling an AndContinue method that might deactivate the app. ValueSet and all the ContinuationData properties and AndContinue methods are Windows Phone only APIs because it's only Windows Phone that has this behavior. For more info, see How to continue your Windows Phone Store app after calling an AndContinue method. The difference between ValueSet and PropertySet is that the ValueSet implementation of methods like Insert/Add enforces that its property values are value types.


This example shows how to check for an item within the IPropertySet object returned by a Windows Runtime property. Specifically, this is from the CoreApplication.Properties property. This code snippet comes from the ControlChannelT​rigger HTTP client sample. Note how the C# version casts to IDictionary<string,object> so that it can use the indexer, whereas the C++/CX version uses HasKey and Lookup. Typically this is all you do with an IPropertySet object that you get from the various Windows Runtime properties that return the type: look for specific keys in the property set, and then set some app property to the corresponding value if it exists.

            // In this example, the channel name has been hardcoded to lookup the property bag 
            // for any previous contexts. The channel name may be used in more sophisticated ways 
            // in case an app has multiple ControlChannelTrigger objects. 
            string channelId = "channelOne"; 
            if (((IDictionary<string, object>)CoreApplication.Properties).ContainsKey(channelId)) 
                    AppContext appContext = null; 
                    lock (CoreApplication.Properties) 
                        appContext = ((IDictionary<string, object>)CoreApplication.Properties)[channelId] as AppContext; 
                    if (appContext != null && appContext.CommunicationInstance != null) 
                        CommunicationModule communicationInstance = appContext.CommunicationInstance; 
                        // Clear any existing channels, sockets etc. 
                        // Create CCT enabled transport. 
                        communicationInstance.SetUpTransport(communicationInstance.serverUri, GetType().Name); 
                catch (Exception ex) 
                    Diag.DebugPrint("Registering with CCT failed with: " + ex.ToString()); 
                Diag.DebugPrint("Cannot find AppContext key channelOne"); 

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

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8


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





See also

IObservableMap(String, Object)
IMap(String, Object)



© 2016 Microsoft