Table of Contents

Class KeyValuePairExtensions

Namespace
Garyon.Extensions
Assembly
Garyon.dll

Provides extensions for the KeyValuePair<TKey, TValue> struct.

public static class KeyValuePairExtensions
Inheritance
KeyValuePairExtensions
Inherited Members

Methods

WithKey<TKey, TValue, TNewKey>(KeyValuePair<TKey, TValue>, TNewKey)

Creates a new KeyValuePair<TKey, TValue> from the given existing one, but with a different key.

public static KeyValuePair<TNewKey, TValue> WithKey<TKey, TValue, TNewKey>(this KeyValuePair<TKey, TValue> kvp, TNewKey key)

Parameters

kvp KeyValuePair<TKey, TValue>

The given KeyValuePair<TKey, TValue>.

key TNewKey

The new key to use in the new KeyValuePair<TKey, TValue>.

Returns

KeyValuePair<TNewKey, TValue>

A new KeyValuePair<TKey, TValue> instance with key as the key, and the value of kvp.

Type Parameters

TKey

The type of the key stored in the original KeyValuePair<TKey, TValue>.

TValue

The type of the value stored in the KeyValuePair<TKey, TValue>.

TNewKey

The type of the key stored in the new KeyValuePair<TKey, TValue>.

WithValue<TKey, TValue, TNewValue>(KeyValuePair<TKey, TValue>, TNewValue)

Creates a new KeyValuePair<TKey, TValue> from the given existing one, but with a different value.

public static KeyValuePair<TKey, TNewValue> WithValue<TKey, TValue, TNewValue>(this KeyValuePair<TKey, TValue> kvp, TNewValue value)

Parameters

kvp KeyValuePair<TKey, TValue>

The given KeyValuePair<TKey, TValue>.

value TNewValue

The new value to use in the new KeyValuePair<TKey, TValue>.

Returns

KeyValuePair<TKey, TNewValue>

A new KeyValuePair<TKey, TValue> instance with the key of kvp, and value as the value.

Type Parameters

TKey

The type of the key stored in the KeyValuePair<TKey, TValue>.

TValue

The type of the value stored in the original KeyValuePair<TKey, TValue>.

TNewValue

The type of the value stored in the new KeyValuePair<TKey, TValue>.