DictionaryExtensionMethods.GetValue<TKey, TValue> Method |
Gets the value for the key from the dictionary specified, or null / default(TValue) if key not found or the key is null.
Namespace:
SD.Tools.BCLExtensions.CollectionsRelated
Assembly:
SD.Tools.BCLExtensions (in SD.Tools.BCLExtensions.dll) Version: 1.2.0
Syntaxpublic static TValue GetValue<TKey, TValue>(
this Dictionary<TKey, TValue> dictionary,
TKey key
)
<ExtensionAttribute>
Public Shared Function GetValue(Of TKey, TValue) (
dictionary As Dictionary(Of TKey, TValue),
key As TKey
) As TValue
Parameters
- dictionary
- Type: System.Collections.Generic.Dictionary<TKey, TValue>
The dictionary. - key
- Type: TKey
The key.
Type Parameters
- TKey
- The type of the key.
- TValue
- The type of the value.
Return Value
Type:
TValuethe value for the key from the dictionary specified, or null / default(TValue) if key not found or the key is null.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Dictionary<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