IMap<K, V> IMap<K, V> IMap<K, V> IMap<K, V> Interface
Definition
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;, .NET code can use the APIs of IDictionary<TKey,TValue> instead.
public : interface IMap<K, V>public interface IMap<K, V>Public Interface IMap<K, V>// You can use this interface in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.FoundationContract (introduced v1)
|
Remarks
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;, .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; interface represents a collection of key-value pairs where a value can be accessed by its associated key. Properties and methods of IMap; 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;.
Interface inheritance
IMap; inherits IIterable;, using an IKeyValuePair constraint that uses the same key and value types. Types that implement IMap; 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
Properties
Size Size Size Size
Gets the number of items in the map.
public : unsigned int Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint// You can use this property in JavaScript.
- Value
- unsigned int uint uint uint
The number of items in the map.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also
Methods
Clear() Clear() Clear() Clear()
Removes all items from the map.
public : void Clear()public void Clear()Public Function Clear() As void// You can use this method in JavaScript.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also
GetView() GetView() GetView() GetView()
Returns an immutable view of the map.
public : IMapView<K, V> GetView()public IReadOnlyDictionary<K, V> GetView()Public Function GetView() As IReadOnlyDictionary( Of K, V )// You can use this method in JavaScript.
The view of the map.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also
HasKey(K) HasKey(K) HasKey(K) HasKey(K)
Determines whether the map contains the specified key.
public : PlatForm::Boolean HasKey(K key)public bool HasKey(K key)Public Function HasKey(key As K) As bool// You can use this method in JavaScript.
- key
- K K K K
The key associated with the item to locate.
True if the key is found; otherwise, false.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also
Insert(K, V) Insert(K, V) Insert(K, V) Insert(K, V)
Inserts or replaces an item in the map.
public : PlatForm::Boolean Insert(K key, V value)public bool Insert(K key, V value)Public Function Insert(key As K, value As V) As bool// You can use this method in JavaScript.
- key
- K K K K
The key associated with the item to insert.
- value
- V V V V
The item to insert.
True if an item with the specified key is an existing item that was replaced; otherwise, false.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also
Lookup(K) Lookup(K) Lookup(K) Lookup(K)
Returns the item at the specified key in the map.
public : V Lookup(K key)public V Lookup(K key)Public Function Lookup(key As K) As V// You can use this method in JavaScript.
- key
- K K K K
The key associated with the item to locate.
The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
Use the HasKey method to determine whether the key exists in the map.
- See Also
Remove(K) Remove(K) Remove(K) Remove(K)
Removes an item from the map.
public : void Remove(K key)public void Remove(K key)Public Function Remove(key As K) As void// You can use this method in JavaScript.
- key
- K K K K
The key associated with the item to remove.
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IDictionary<TKey,TValue> interface.
- See Also