System::Collections::Generic::KeyValuePair< TKey, TValue > Class Template Reference

Pair of key and value. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type. More...

#include <keyvalue_pair.h>

Public Member Functions

 KeyValuePair ()
 Null key-value pair initializer.
 
 KeyValuePair (const TKey &key, const TValue &value)
 Constructor.
 
template<typename OtherK , typename OtherV >
 KeyValuePair (const std::pair< OtherK, OtherV > &pair)
 Type conversion constructor.
 
const TKey & get_Key () const
 Gets key.
 
const TValue & get_Value () const
 Gets value.
 
bool IsNull () const
 Always returns false.
 
bool operator< (const KeyValuePair &kvp) const
 Patch for classes inherited from IComparer<KeyValuePair<TKey, TValue>>, doesn't compare anything.
 
String ToString () const
 Converts key-value pair to string.
 
int GetHashCode () const
 Calculates key-value pair hash by xoring key's and value's hashes.
 

Public Attributes

std::pair< TKey, TValue > m_pair
 Internal data structure.
 

Detailed Description

template<typename TKey, typename TValue>
class System::Collections::Generic::KeyValuePair< TKey, TValue >

Pair of key and value. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

Parameters
TKeyKey type.
TValueValue type.

Constructor & Destructor Documentation

◆ KeyValuePair() [1/3]

template<typename TKey , typename TValue >
System::Collections::Generic::KeyValuePair< TKey, TValue >::KeyValuePair ( )
inline

Null key-value pair initializer.

◆ KeyValuePair() [2/3]

template<typename TKey , typename TValue >
System::Collections::Generic::KeyValuePair< TKey, TValue >::KeyValuePair ( const TKey & key,
const TValue & value )
inline

Constructor.

Parameters
keyKey.
valueValue.

◆ KeyValuePair() [3/3]

template<typename TKey , typename TValue >
template<typename OtherK , typename OtherV >
System::Collections::Generic::KeyValuePair< TKey, TValue >::KeyValuePair ( const std::pair< OtherK, OtherV > & pair)
inline

Type conversion constructor.

Template Parameters
OtherKOther key type.
OtherVOther value type.
Parameters
pairPair value.

Member Function Documentation

◆ get_Key()

template<typename TKey , typename TValue >
const TKey & System::Collections::Generic::KeyValuePair< TKey, TValue >::get_Key ( ) const
inline

Gets key.

Returns
Const reference to key.

◆ get_Value()

template<typename TKey , typename TValue >
const TValue & System::Collections::Generic::KeyValuePair< TKey, TValue >::get_Value ( ) const
inline

Gets value.

Returns
Const reference to value.

◆ GetHashCode()

template<typename TKey , typename TValue >
int System::Collections::Generic::KeyValuePair< TKey, TValue >::GetHashCode ( ) const
inline

Calculates key-value pair hash by xoring key's and value's hashes.

Returns
Resulting hash value.

◆ IsNull()

template<typename TKey , typename TValue >
bool System::Collections::Generic::KeyValuePair< TKey, TValue >::IsNull ( ) const
inline

Always returns false.

◆ operator<()

template<typename TKey , typename TValue >
bool System::Collections::Generic::KeyValuePair< TKey, TValue >::operator< ( const KeyValuePair< TKey, TValue > & kvp) const
inline

Patch for classes inherited from IComparer<KeyValuePair<TKey, TValue>>, doesn't compare anything.

Parameters
kvpDummy argument.
Returns
Always returns false.

◆ ToString()

template<typename TKey , typename TValue >
String System::Collections::Generic::KeyValuePair< TKey, TValue >::ToString ( ) const
inline

Converts key-value pair to string.

Returns
String representation of key-value type.

Member Data Documentation

◆ m_pair

template<typename TKey , typename TValue >
std::pair<TKey, TValue> System::Collections::Generic::KeyValuePair< TKey, TValue >::m_pair

Internal data structure.