Windows.Foundation.Collections Namespace

Defines standard, specialized, and generic collection objects. This includes the IIterable<T>, IVector<T> and IMap<K,V> generic interfaces, which are used as the pattern for basic collection support throughout the Windows Runtime API.

Classes

PropertySet

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

StringMap

An associative collection, also known as a map or a dictionary.

ValueSet

Implements a map with keys of type String and values of type Object. Object must be a WinRT PropertyValue or ValueSet. As a PropertyValue, it can be any type except PropertyType InspectableArray. This limitation exists to ensure that the value can be serialized; passed by value across a process boundary.

Note

Some members are only available for the specified language.

Interfaces

IIterable<T>

Exposes an iterator that supports simple iteration over a collection of a specified type.

.NET This interface appears as System.Collections.Generic.IEnumerable<T>. In any case where a Windows Runtime type has implemented IIterable<T>, .NET code can use the APIs of IEnumerable<T> instead. C# code can use foreach, Visual Basic code can use For Each...Next. All the .NET extension methods that are based on IEnumerable<T> and included in .NET for UWP apps are accessible (including the System.Linq extensions, so long as you've included the namespace).

IIterator<T>

Supports simple iteration over a collection.

IKeyValuePair<K,V>

Represents a key-value pair. This is typically used as a constraint type when you need to encapsulate two type parameters into one to satisfy the constraints of another generic interface.

.NET This interface appears as System.Collections.Generic.KeyValuePair<TKey,TValue> (a structure, not an interface). In any case where a Windows Runtime type has implemented IKeyValuePair<K,V>, .NET code can use the APIs of KeyValuePair instead.

IMap<K,V>

Represents an associative collection, also known as a map or a dictionary.

.NET This interface appears to .NET code as System.Collections.Generic.IDictionary<TKey,TValue> due to .NET language projection. In any case where a Windows Runtime type has implemented IMap<K,V>, .NET code can use the APIs of IDictionary<TKey,TValue> instead.

IMapChangedEventArgs<K>

Provides data for the changed event of a map collection.

IMapView<K,V>

Represents an immutable view into a map.

.NET This interface appears as System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> due to .NET language projection. In any case where a Windows Runtime type has implemented IMapView<K,V>, .NET code can use the APIs of IReadOnlyDictionary<TKey,TValue> instead.

IObservableMap<K,V>

Notifies listeners of dynamic changes to a map, such as when items are added or removed.

IObservableVector<T>

Notifies listeners of changes to the vector.

IPropertySet

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

IVector<T>

Represents a random-access collection of elements.

.NET This interface appears to .NET code as System.Collections.Generic.IList<T> due to .NET language projection. In any case where a Windows Runtime type has implemented IVector<T>, .NET code can use the APIs of IList<T> instead.

IVectorChangedEventArgs

Provides data for the changed event of a vector.

IVectorView<T>

Represents an immutable view into a vector.

.NET This interface appears to .NET code as System.Collections.Generic.IReadOnlyList<T> due to .NET language projection. In any case where a Windows Runtime type has implemented IVectorView<T>, .NET code can use the APIs of IReadOnlyList<T> instead.

Enums

CollectionChange

Describes the action that causes a change to a collection.

Delegates

MapChangedEventHandler<K,V>

Represents the method that handles the changed event of an observable map.

VectorChangedEventHandler<T>

Represents the method that handles the changed event of an observable vector.

Remarks

Many of the interfaces and objects defined in this namespace have different language equivalents depending on the programming language you are using. For more info on using these interfaces from C++ code, see Collections (C++/CX). For more info on using collection types from .NET code, see the Remarks in the specific types defined in this namespace.

See also