Class IDictionaryExtensions
Represents the dictionary extensions.
Namespace: Platform.Collections
Assembly: Platform.Collections.dll
Syntax
public static class IDictionaryExtensions : object
Methods
| Improve this Doc View SourceGetOrAdd<TKey, TValue>(IDictionary<TKey, TValue>, TKey, Func<TKey, TValue>)
Gets the or add using the specified dictionary.
Declaration
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<TKey, TValue> | dictionary | The dictionary.
|
| TKey | key | The key.
|
| Func<TKey, TValue> | valueFactory | The value factory.
|
Returns
| Type | Description |
|---|---|
| TValue | The value.
|
Type Parameters
| Name | Description |
|---|---|
| TKey | The key.
|
| TValue | The value.
|
GetOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey)
Gets the or default using the specified dictionary.
Declaration
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<TKey, TValue> | dictionary | The dictionary.
|
| TKey | key | The key.
|
Returns
| Type | Description |
|---|---|
| TValue | The value.
|
Type Parameters
| Name | Description |
|---|---|
| TKey | The key.
|
| TValue | The value.
|