IMapView<K, V> interface

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.

Syntax


generic<typename K, typename V>
public interface class IMapView : IIterable<IKeyValuePair>

Attributes

[Version(0x06020000)]

Type parameters

K

The type of the keys in the map.

V

The type of the values in the map.

Members

The IMapView interface inherits from IIterable(IKeyValuePair). IMapView also has these types of members:

Methods

The IMapView interface has these methods. It also inherits methods from the Object class.

MethodDescription
HasKey Determines whether the map view contains the specified key.
Lookup Returns the item at the specified key in the map view.
Split Splits the map view into two views.

 

Properties

The IMapView interface has these properties.

PropertyAccess typeDescription

Size

Read-onlyGets the number of elements in the map.

 

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<K,V>, .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<K,V> interface represents a collection of key-value pairs where a value can be accessed by its associated key. Properties and methods of IMapView<K,V> 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.

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows::Foundation::Collections

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows::Foundation::Collections

Metadata

Windows.winmd

See also

IIterable(IKeyValuePair)
IReadOnlyDictionary<TKey,TValue>
Collections (C++/CX)

 

 

Show:
© 2015 Microsoft