DictionaryExtensions.GetOrDefault<TK,TV> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value by the given key.
public:
generic <typename TK, typename TV>
[System::Runtime::CompilerServices::Extension]
static TV GetOrDefault(System::Collections::Generic::IDictionary<TK, TV> ^ dictionary, TK key);
public static TV GetOrDefault<TK,TV> (this System.Collections.Generic.IDictionary<TK,TV> dictionary, TK key);
static member GetOrDefault : System.Collections.Generic.IDictionary<'K, 'V> * 'K -> 'V
<Extension()>
Public Function GetOrDefault(Of TK, TV) (dictionary As IDictionary(Of TK, TV), key As TK) As TV
Type Parameters
- TK
key type
- TV
value type
Parameters
- dictionary
- IDictionary<TK,TV>
dictionary
- key
- TK
key in the dictionary
Returns
TV
default if key doesn't exist in the dictionary.