Table of Contents

Class KeyValuePairExtensions

Namespace
OverKizApi
Assembly
OverKizApi.dll

Provides KeyValuePair<TKey,TValue>.Deconstruct for targets below .NET 5 where the BCL does not include it, allowing foreach (var (key, value) in dict) syntax.

public static class KeyValuePairExtensions
Inheritance
KeyValuePairExtensions
Inherited Members

Methods

Deconstruct<TKey, TValue>(KeyValuePair<TKey, TValue>, out TKey, out TValue)

Deconstructs a KeyValuePair<TKey, TValue> into its key and value components, enabling foreach (var (key, value) in dictionary) syntax on targets below .NET 5 where the BCL does not provide this method natively.

public static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value)

Parameters

pair KeyValuePair<TKey, TValue>

The key/value pair to deconstruct.

key TKey

Receives the Key.

value TValue

Receives the Value.

Type Parameters

TKey

The type of the key.

TValue

The type of the value.