Table of Contents

Class DictionaryExtensions

Namespace
Shift.Common
Assembly
Shift.Common.dll
public static class DictionaryExtensions
Inheritance
DictionaryExtensions
Inherited Members

Methods

GetOrAdd<TKey, TValue>(IDictionary<TKey, TValue>, TKey, Func<TValue>)

public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, Func<TValue> valueFactory)

Parameters

dict IDictionary<TKey, TValue>
key TKey
valueFactory Func<TValue>

Returns

TValue

Type Parameters

TKey
TValue

GetOrAdd<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)

public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue value)

Parameters

dict IDictionary<TKey, TValue>
key TKey
value TValue

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(Dictionary<TKey, TValue>, TKey)

public static TValue GetOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key)

Parameters

dict Dictionary<TKey, TValue>
key TKey

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(Dictionary<TKey, TValue>, TKey, Func<TValue>)

public static TValue GetOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultFactory)

Parameters

dict Dictionary<TKey, TValue>
key TKey
defaultFactory Func<TValue>

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(Dictionary<TKey, TValue>, TKey, TValue)

public static TValue GetOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dict, TKey key, TValue defaultValue)

Parameters

dict Dictionary<TKey, TValue>
key TKey
defaultValue TValue

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey)

public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key)

Parameters

dict IDictionary<TKey, TValue>
key TKey

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey, Func<TValue>)

public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultFactory)

Parameters

dict IDictionary<TKey, TValue>
key TKey
defaultFactory Func<TValue>

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)

public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, TValue defaultValue)

Parameters

dict IDictionary<TKey, TValue>
key TKey
defaultValue TValue

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>, TKey)

public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key)

Parameters

dict IReadOnlyDictionary<TKey, TValue>
key TKey

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>, TKey, Func<TValue>)

public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultFactory)

Parameters

dict IReadOnlyDictionary<TKey, TValue>
key TKey
defaultFactory Func<TValue>

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>, TKey, TValue)

public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key, TValue defaultValue)

Parameters

dict IReadOnlyDictionary<TKey, TValue>
key TKey
defaultValue TValue

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(ReadOnlyDictionary<TKey, TValue>, TKey)

public static TValue GetOrDefault<TKey, TValue>(this ReadOnlyDictionary<TKey, TValue> dict, TKey key)

Parameters

dict ReadOnlyDictionary<TKey, TValue>
key TKey

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(ReadOnlyDictionary<TKey, TValue>, TKey, Func<TValue>)

public static TValue GetOrDefault<TKey, TValue>(this ReadOnlyDictionary<TKey, TValue> dict, TKey key, Func<TValue> defaultFactory)

Parameters

dict ReadOnlyDictionary<TKey, TValue>
key TKey
defaultFactory Func<TValue>

Returns

TValue

Type Parameters

TKey
TValue

GetOrDefault<TKey, TValue>(ReadOnlyDictionary<TKey, TValue>, TKey, TValue)

public static TValue GetOrDefault<TKey, TValue>(this ReadOnlyDictionary<TKey, TValue> dict, TKey key, TValue defaultValue)

Parameters

dict ReadOnlyDictionary<TKey, TValue>
key TKey
defaultValue TValue

Returns

TValue

Type Parameters

TKey
TValue

ToDictionary(NameValueCollection)

public static Dictionary<string, string> ToDictionary(this NameValueCollection col)

Parameters

col NameValueCollection

Returns

Dictionary<string, string>