-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_DictionaryExtensions_GetValueOrDefault__2_11
andrewvk edited this page Apr 26, 2016
·
5 revisions
DictionaryExtensions.GetValueOrDefault(TKey, TValue) Method (IReadOnlyDictionary(TKey, TValue), TKey, TValue)
[This is preliminary documentation and is subject to change.]
Returns value associated with key, or defaultValue if key does not exists in dictionary
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 1.0.0.0 (1.0.0.0)
C#
public static TValue GetValueOrDefault<TKey, TValue>(
this IReadOnlyDictionary<TKey, TValue> dictionary,
TKey key,
TValue defaultValue
)
VB
<ExtensionAttribute>
Public Shared Function GetValueOrDefault(Of TKey, TValue) (
dictionary As IReadOnlyDictionary(Of TKey, TValue),
key As TKey,
defaultValue As TValue
) As TValue
F#
[<ExtensionAttribute>]
static member GetValueOrDefault :
dictionary : IReadOnlyDictionary<'TKey, 'TValue> *
key : 'TKey *
defaultValue : 'TValue -> 'TValue
- dictionary
- Type: System.Collections.Generic.IReadOnlyDictionary(TKey, TValue)
The dictionary. - key
- Type: TKey
The key. - defaultValue
- Type: TValue
Default value.
- TKey
- The type of the key.
- TValue
- The type of the value.
Type: TValue
Value, associated with the key, or defaultValue if key does not exists in dictionary
In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyDictionary(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).
DictionaryExtensions Class
GetValueOrDefault Overload
CodeJam.Collections Namespace