I​Map​View<​K, ​V> I​Map​View<​K, ​V> I​Map​View<​K, ​V> Interface

Definition

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;, .NET code can use the APIs of IReadOnlyDictionary<TKey,TValue> instead.

public interface IMapView<K, V>public interface IMapView<K, V>Public Interface IMapView<K, V>
Attributes
Windows 10 requirements
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.IReadOnlyDictionary<TKey,TValue> interface if they want to implement a read-only map/dictionary type. In any case where a Windows Runtime type has implemented IMapView;, .NET code can use the APIs of IReadOnlyDictionary<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 IMapView; interface represents a collection of key-value pairs where a value can be accessed by its associated key. Properties and methods of IMapView; support dictionary-type functionality, such as getting the size of the collection, or lookups, but don't support adding or removing items because the map is read-only.

Interface inheritance

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

Properties

Size Size Size

Gets the number of elements in the map.

public uint Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint
Value
uint uint uint

The number of elements in the map.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> interface.

Methods

HasKey(K) HasKey(K) HasKey(K)

Determines whether the map view contains the specified key.

public bool HasKey(K key)public bool HasKey(K key)Public Function HasKey(key As K) As bool
Parameters
key
K K K

The key to locate in the map view.

Returns
bool bool bool

True if the key is found; otherwise, false.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> interface.

Lookup(K) Lookup(K) Lookup(K)

Returns the item at the specified key in the map view.

public V Lookup(K key)public V Lookup(K key)Public Function Lookup(key As K) As V
Parameters
key
K K K

The key to locate in the map view.

Returns
V V V

The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> interface.

Split(IMapView<K, V>, IMapView<K, V>) Split(IMapView<K, V>, IMapView<K, V>) Split(IMapView<K, V>, IMapView<K, V>)

Splits the map view into two views.

public void Split(IMapView<K, V> first, IMapView<K, V> second)public void Split(IMapView<K, V> first, IMapView<K, V> second)Public Function Split(first As IMapView<K, V>, second As IMapView<K, V>) As void
Parameters
first

One half of the original map.

second

The second half of the original map.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IReadOnlyDictionary<TKey,TValue> interface.

The two views that result from the split operation may not contain the same number of items. The two views do not overlap.

If the IMapView, V> instance cannot be split, then both the first and second parameters are null when the method returns.

See Also