Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IKeyValuePair<K, V> interface

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.

Syntax


generic<typename K, typename V>
public interface class IKeyValuePair

Type parameters

K

The type of the keys in each key-value pair.

V

The type of the values in each key-value pair.

Members

The IKeyValuePair interface inherits from the IUnknown interface. IKeyValuePair also has these types of members:

Properties

The IKeyValuePair interface has these properties.

PropertyAccess typeDescription

Key

Read-onlyGets the key of the key-value pair.

Value

Read-onlyGets the value of the key-value pair.

 

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.KeyValuePair<TKey,TValue> structure. In any case where a Windows Runtime type has implemented IKeyValuePair<K,V>, including when interfaces have inherited IKeyValuePair<K,V> or used it as an inner constraint, .NET code can treat it as a .NET KeyValuePair.

Key-value pairs are used in the IMap<K,V> interface, when it inherits IIterable<T>. Practical implementations of IMap<K,V> are iterable, and iterating or calling First/Current explicitly will return instances of IKeyValuePair<K,V> using the same constraints as does the IMap<K,V> implementation.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows::Foundation::Collections

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows::Foundation::Collections

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]

See also

IMap<K,V>
KeyValuePair<TKey,TValue>

 

 

Show:
© 2015 Microsoft