IMap<K,V> Interface


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.

public interface class IMap : IIterable<IKeyValuePair<K, V> ^>
template <typename K, typename V>
__interface IMap : IIterable<IKeyValuePair<K, V>>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.Guid(1009329662, 34073, 17857, 170, 121, 25, 123, 103, 24, 193, 193)]
public interface IDictionary<K,V> : IEnumerable<KeyValuePair<K,V>>
Public Interface IDictionary(Of K, V)
Implements IEnumerable(Of KeyValuePair(Of K, V))

Type Parameters

<xref href="System.Collections.Generic.IEnumerable`1?alt=System.Collections.Generic.IEnumerable&text=IEnumerable" data-throw-if-not-resolved="True"/>&lt;<xref href="System.Collections.Generic.KeyValuePair`2?alt=System.Collections.Generic.KeyValuePair&text=KeyValuePair" data-throw-if-not-resolved="True"/>&lt;K,V&gt;&gt;

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced in v1.0)


When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface if they want to implement a map/dictionary type. In any case where a Windows Runtime type has implemented IMap<K,V>, .NET code can use the APIs of IDictionary<TKey,TValue> instead. This includes all the existing Windows Runtime API and also scenarios such as using the APIs of Windows Runtime components originally implemented in Visual C++ component extensions (C++/CX) from a C# or Visual Basic app.

The IMap<K,V> interface represents a collection of key-value pairs where a value can be accessed by its associated key. Properties and methods of IMap<K,V> support dictionary-type functionality, such as getting the size of the collection, and adding and removing items at specified locations in the collection. Additionally, the GetView method provides a snapshot of the map whose observable state does not change. The snapshot is useful when you need a view of the collection to refer to in subsequent operations that involve IMap<K,V>.

Interface inheritance

IMap<K,V> inherits IIterable;, using an IKeyValuePair constraint that uses the same key and value types. Types that implement IMap<K,V> also implement the interface members of IIterable;, with IKeyValuePair type constraint sharing the same key and value. Similarly, if you're using .NET, there is support for IEnumerable, with its constraint type as a KeyValuePair that uses the same key and value types as does the IDictionary<TKey,TValue> implementation.



Gets the number of items in the map.



Removes all items from the map.


Returns an immutable view of the map.


Determines whether the map contains the specified key.

Insert(K, V)

Inserts or replaces an item in the map.


Returns the item at the specified key in the map.


Removes an item from the map.

Applies to

See also