DictionaryExtensions GetValueOrDefault TKey, TValue Method | Glimpse API Documentation |
Gets the value, if available, or ifNotFound.
Namespace: Glimpse.Core.ExtensionsAssembly: Glimpse.Core (in Glimpse.Core.dll) Version: 1.0.1.0 (1.0.1)
Syntax
public static TValue GetValueOrDefault<TKey, TValue>( this IDictionary<TKey, TValue> dictionary, TKey key, TValue ifNotFound = null )
public static TValue GetValueOrDefault<TKey, TValue>( this IDictionary<TKey, TValue> dictionary, TKey key, TValue ifNotFound = null )
Parameters
- dictionary
- Type: System.Collections.Generic IDictionary TKey, TValue
The dictionary to search.
- key
- Type: TKey
The item key.
- ifNotFound (Optional)
- Type: TValue
The fallback value.
Type Parameters
- TKey
- The type of the key.
- TValue
- The type of the value.
Return Value
Returns the item in dictionary that matches key, falling back to the value of ifNotFound if the item is unavailable.Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IDictionary TKey, TValue . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).See Also