Class DictionaryExtensions
Extension methods for System.Collections.Generic.IDictionary<TKey, TValue>.
Inheritance
System.Object
DictionaryExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Kephas.Collections
Assembly: Kephas.Core.dll
Syntax
public static class DictionaryExtensions
Methods
| Improve this Doc View SourceTryGetValue<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)
Tries to get the value for the provided key. If the requested item cannot be found, the default value is returned.
Declaration
public static TValue TryGetValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | dictionary | The dictionary. |
TKey | key | The item's key. |
TValue | defaultValue | The default value to return if the item could not be found. |
Returns
Type | Description |
---|---|
TValue | The found value, or the default value. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |