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

Public Member Functions

 KeyValuePair ()
 Null key-value pair initializer. More...
 
 KeyValuePair (const TKey &key, const TValue &value)
 
template<typename OtherK , typename OtherV >
 KeyValuePair (const std::pair< OtherK, OtherV > &pair)
 
const TKey & get_Key () const
 
const TValue & get_Value () const
 
bool IsNull () const
 Always returns false. More...
 
bool operator< (const KeyValuePair &kvp) const
 
String ToString () const
 
int GetHashCode () const
 

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.